arb_bindless_texture: Fix memory leaks.

Submitted by Vinson Lee on April 12, 2017, 11:16 p.m.

Details

Message ID 1492038981-3131-1-git-send-email-vlee@freedesktop.org
State New
Headers show
Series "arb_bindless_texture: Fix memory leaks." ( rev: 1 ) in Piglit

Not browsing as part of any series.

Commit Message

Vinson Lee April 12, 2017, 11:16 p.m.
CID: 1405026
Fixes: 66676a2fcd48 ("add API-related tests for ARB_bindless_texture")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
---
 tests/spec/arb_bindless_texture/legal.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/tests/spec/arb_bindless_texture/legal.c b/tests/spec/arb_bindless_texture/legal.c
index 0084e7dea965..cede6da74379 100644
--- a/tests/spec/arb_bindless_texture/legal.c
+++ b/tests/spec/arb_bindless_texture/legal.c
@@ -48,8 +48,10 @@  call_TexSubImage_when_texture_is_referenced(void *data)
 	tex = piglit_integer_texture(GL_RGBA32I, 16, 16, 0, 0);
 
 	glGetTextureHandleARB(tex);
-	if (!piglit_check_gl_error(GL_NO_ERROR))
+	if (!piglit_check_gl_error(GL_NO_ERROR)) {
+		free(img);
 		return PIGLIT_FAIL;
+	}
 
 	/* The ARB_bindless_texture spec says:
 	 *
@@ -61,10 +63,10 @@  call_TexSubImage_when_texture_is_referenced(void *data)
 	 */
 	glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 16, 16, GL_RGBA_INTEGER,
 			GL_INT, img);
+	free(img);
 	if (!piglit_check_gl_error(GL_NO_ERROR))
 		return PIGLIT_FAIL;
 
-	free(img);
 	return PIGLIT_PASS;
 }
 

Comments

There is memleak in 
call_CompressedTexSubImage_when_texture_is_referenced() also. Can you 
fix that one?

Thanks for noticing.

On 04/13/2017 01:16 AM, Vinson Lee wrote:
> CID: 1405026
> Fixes: 66676a2fcd48 ("add API-related tests for ARB_bindless_texture")
> Signed-off-by: Vinson Lee <vlee@freedesktop.org>
> ---
>   tests/spec/arb_bindless_texture/legal.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/spec/arb_bindless_texture/legal.c b/tests/spec/arb_bindless_texture/legal.c
> index 0084e7dea965..cede6da74379 100644
> --- a/tests/spec/arb_bindless_texture/legal.c
> +++ b/tests/spec/arb_bindless_texture/legal.c
> @@ -48,8 +48,10 @@ call_TexSubImage_when_texture_is_referenced(void *data)
>   	tex = piglit_integer_texture(GL_RGBA32I, 16, 16, 0, 0);
>   
>   	glGetTextureHandleARB(tex);
> -	if (!piglit_check_gl_error(GL_NO_ERROR))
> +	if (!piglit_check_gl_error(GL_NO_ERROR)) {
> +		free(img);
>   		return PIGLIT_FAIL;
> +	}
>   
>   	/* The ARB_bindless_texture spec says:
>   	 *
> @@ -61,10 +63,10 @@ call_TexSubImage_when_texture_is_referenced(void *data)
>   	 */
>   	glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 16, 16, GL_RGBA_INTEGER,
>   			GL_INT, img);
> +	free(img);
>   	if (!piglit_check_gl_error(GL_NO_ERROR))
>   		return PIGLIT_FAIL;
>   
> -	free(img);
>   	return PIGLIT_PASS;
>   }
>   
>