[PATCH i-g-t v1 4/6] lib/igt_kms: Set free'd pointer to NULL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Avoid double free's by setting the free'd pointer to NULL after
free.

Signed-off-by: Robert Foss <robert.foss@xxxxxxxxxxxxx>
---
 lib/igt_kms.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 8c10568a..52e1f179 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -1700,6 +1700,7 @@ static void igt_output_fini(igt_output_t *output)
 {
 	kmstest_free_connector_config(&output->config);
 	free(output->name);
+	output->name = NULL;
 }
 
 /**
@@ -1719,8 +1720,9 @@ void igt_display_fini(igt_display_t *display)
 	for (i = 0; i < display->n_outputs; i++)
 		igt_output_fini(&display->outputs[i]);
 	free(display->outputs);
-	free(display->pipes);
 	display->outputs = NULL;
+	free(display->pipes);
+	display->pipes = NULL;
 }
 
 static void igt_display_refresh(igt_display_t *display)
-- 
2.11.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux