[Piglit] [PATCH v2] cl-api-enqueue-fill-image: Fix memory leaks.

Vinson Lee vlee at freedesktop.org
Sun Nov 22 15:10:59 PST 2015


Fixes Coverity "resource leak" defects.

Suggested-by: Serge Martin <edb+piglit at sigluy.net>
Signed-off-by: Vinson Lee <vlee at freedesktop.org>
---
 tests/cl/api/enqueue-fill-image.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/cl/api/enqueue-fill-image.c b/tests/cl/api/enqueue-fill-image.c
index ebcfba4..2839b67 100644
--- a/tests/cl/api/enqueue-fill-image.c
+++ b/tests/cl/api/enqueue-fill-image.c
@@ -114,6 +114,9 @@ piglit_cl_test(const int argc,
 		return PIGLIT_SKIP;
 	}
 
+	free(image_support);
+	image_support = NULL;
+
 	img_format.image_channel_order = CL_RGBA;
 	img_format.image_channel_data_type = CL_UNSIGNED_INT8;
 	img_desc.image_type = CL_MEM_OBJECT_IMAGE2D;
@@ -325,7 +328,6 @@ piglit_cl_test(const int argc,
 	 */
 	/* This is a per device test, clCreateImage would have failed before */
 
-	free(image_support);
 	clReleaseMemObject(image);
 	return result;
 #else
-- 
2.6.3



More information about the Piglit mailing list