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

Robert Foss robert.foss at collabora.com
Thu Jan 19 16:35:04 UTC 2017


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

Signed-off-by: Robert Foss <robert.foss at collabora.com>
---
 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



More information about the Intel-gfx mailing list