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

Vinson Lee vlee at freedesktop.org
Mon Nov 16 23:48:14 PST 2015


Fixes Coverity "resource leak" defects.

Signed-off-by: Vinson Lee <vlee at freedesktop.org>
---
 tests/cl/api/enqueue-fill-image.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tests/cl/api/enqueue-fill-image.c b/tests/cl/api/enqueue-fill-image.c
index ebcfba4..994ccb4 100644
--- a/tests/cl/api/enqueue-fill-image.c
+++ b/tests/cl/api/enqueue-fill-image.c
@@ -129,12 +129,14 @@ piglit_cl_test(const int argc,
 	if(!piglit_cl_check_error(err, CL_SUCCESS)) {
 		fprintf(stderr, "Failed (error code: %s): Creating an image\n",
 		        piglit_cl_get_error_name(err));
+		free(image_support);
 		return PIGLIT_FAIL;
 	}
 
 	if (!test(queue, image, pattern, origin, region,
 	          0, NULL, NULL,
 	          CL_SUCCESS, &result, "Enqueuing the image to be filled")) {
+		free(image_support);
 		return PIGLIT_FAIL;
 	}
 
@@ -145,6 +147,7 @@ piglit_cl_test(const int argc,
 	if(!piglit_cl_check_error(err, CL_SUCCESS)) {
 		fprintf(stderr, "Failed (error code: %s): Reading image\n",
 		        piglit_cl_get_error_name(err));
+		free(image_support);
 		return PIGLIT_FAIL;
 	}
 
@@ -169,6 +172,7 @@ piglit_cl_test(const int argc,
 		if (!piglit_cl_probe_integer(dst_buf[i], exp_buf[i], 0)) {
 			fprintf(stderr, "Error at %d: got %d, expected %d\n",
 			        i, dst_buf[i], exp_buf[i]);
+			free(image_support);
 			return PIGLIT_FAIL;
 		}
 	}
-- 
2.6.3



More information about the Piglit mailing list