ext_image_dma_buf: Fix memory leak.

Submitted by Vinson Lee on July 1, 2016, 10:48 p.m.

Details

Message ID 1467413303-23575-1-git-send-email-vlee@freedesktop.org
State New
Headers show
Series "ext_image_dma_buf: Fix memory leak." ( rev: 1 ) in Piglit

Not browsing as part of any series.

Commit Message

Vinson Lee July 1, 2016, 10:48 p.m.
Fix Coverity resource leak defect.

CID: 1313530
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
---
 tests/spec/ext_image_dma_buf_import/transcode-nv12-as-r8-gr88.c | 2 ++
 1 file changed, 2 insertions(+)

Patch hide | download patch | download mbox

diff --git a/tests/spec/ext_image_dma_buf_import/transcode-nv12-as-r8-gr88.c b/tests/spec/ext_image_dma_buf_import/transcode-nv12-as-r8-gr88.c
index 1e5485556111..b172255732cf 100644
--- a/tests/spec/ext_image_dma_buf_import/transcode-nv12-as-r8-gr88.c
+++ b/tests/spec/ext_image_dma_buf_import/transcode-nv12-as-r8-gr88.c
@@ -294,8 +294,10 @@  piglit_display(void)
 	piglit_tolerance[2] = 0.05;
 	if (!piglit_probe_image_rgba(0, 0, piglit_width, piglit_height,
 				     ref_rgba_image)) {
+		free(ref_rgba_image);
 		return PIGLIT_FAIL;
 	}
 
+	free(ref_rgba_image);
 	return PIGLIT_PASS;
 }

Comments

On Fri 01 Jul 2016, Vinson Lee wrote:
> Fix Coverity resource leak defect.
> 
> CID: 1313530
> Signed-off-by: Vinson Lee <vlee@freedesktop.org>
> ---
>  tests/spec/ext_image_dma_buf_import/transcode-nv12-as-r8-gr88.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/tests/spec/ext_image_dma_buf_import/transcode-nv12-as-r8-gr88.c b/tests/spec/ext_image_dma_buf_import/transcode-nv12-as-r8-gr88.c
> index 1e5485556111..b172255732cf 100644
> --- a/tests/spec/ext_image_dma_buf_import/transcode-nv12-as-r8-gr88.c
> +++ b/tests/spec/ext_image_dma_buf_import/transcode-nv12-as-r8-gr88.c
> @@ -294,8 +294,10 @@ piglit_display(void)
>  	piglit_tolerance[2] = 0.05;
>  	if (!piglit_probe_image_rgba(0, 0, piglit_width, piglit_height,
>  				     ref_rgba_image)) {
> +		free(ref_rgba_image);
>  		return PIGLIT_FAIL;
>  	}
>  
> +	free(ref_rgba_image);
>  	return PIGLIT_PASS;

Reviewed-by: Chad Versace <chad.versace@intel.com>
And pushed.

There are two calls to piglit_report_result() that also trigger the
leak. Those should be fixed too.