[igt-dev] [PATCH i-g-t 2/3] tests/kms_cursor_crc: Fix segfault on skip

Ville Syrjala ville.syrjala at linux.intel.com
Wed Jul 15 15:05:41 UTC 2020


From: Ville Syrjälä <ville.syrjala at linux.intel.com>

The fixture at the end of the test currently tries to free the
batch whether or not it even got allocated. This causes the test
to segfault on many skips. Check that we have the batch before
trying to free it.

Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
 tests/kms_cursor_crc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c
index 7e6b24cc04a3..dc0880a77e87 100644
--- a/tests/kms_cursor_crc.c
+++ b/tests/kms_cursor_crc.c
@@ -827,10 +827,10 @@ igt_main
 			igt_pipe_crc_free(data.pipe_crc);
 		}
 
-		if (data.bufmgr != NULL) {
+		if (data.batch != NULL)
 			intel_batchbuffer_free(data.batch);
+		if (data.bufmgr != NULL)
 			drm_intel_bufmgr_destroy(data.bufmgr);
-		}
 
 		igt_display_fini(&data.display);
 	}
-- 
2.26.2



More information about the igt-dev mailing list