diff mbox

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

Message ID 20170119163506.13270-5-robert.foss@collabora.com (mailing list archive)
State New, archived
Headers show

Commit Message

Robert Foss Jan. 19, 2017, 4:35 p.m. UTC
Avoid double free's by setting the free'd pointer to NULL after
free.

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

Patch

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)