ext_image_dma_buf: Fix memory leak.

Submitted by Vinson Lee on Aug. 18, 2015, 4:46 a.m.

Details

Message ID 1439873168-16963-1-git-send-email-vlee@freedesktop.org
State New
Headers show

Not browsing as part of any series.

Commit Message

Vinson Lee Aug. 18, 2015, 4:46 a.m.
Fix resource leak defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
---
 tests/spec/ext_image_dma_buf_import/transcode-nv12-as-r8-gr88.c | 3 +++
 1 file changed, 3 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 1e54855..e23e144 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,11 @@  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 08/18/2015 07:46 AM, Vinson Lee wrote:
> Fix resource leak defect reported by Coverity.
>
> Signed-off-by: Vinson Lee <vlee@freedesktop.org>
> ---
>   tests/spec/ext_image_dma_buf_import/transcode-nv12-as-r8-gr88.c | 3 +++
>   1 file changed, 3 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 1e54855..e23e144 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,11 @@ 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;
>   }

There are 2 more exit paths before these with piglit_report_result, they 
are leaking too.

// Tapani