[Piglit] [PATCH] cl-api-create-image: Fix memory leak.

Vinson Lee vlee at freedesktop.org
Tue Dec 16 22:20:52 PST 2014


Fix Coverity "resource leak" defect.

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

diff --git a/tests/cl/api/create-image.c b/tests/cl/api/create-image.c
index 46a98dd..a1e143b 100644
--- a/tests/cl/api/create-image.c
+++ b/tests/cl/api/create-image.c
@@ -44,8 +44,11 @@ static bool context_has_image_support(const piglit_cl_context ctx)
 			piglit_cl_get_device_info(ctx->device_ids[i],
 						CL_DEVICE_IMAGE_SUPPORT);
 		if (*image_support) {
+			free(image_support);
 			return true;
 		}
+
+		free(image_support);
 	}
 	return false;
 }
-- 
1.9.2



More information about the Piglit mailing list