[Piglit] [PATCH] arb_direct_state_access: Fix memory leak.

Brian Paul brianp at vmware.com
Thu Jan 8 18:18:23 PST 2015


On 01/08/2015 06:43 PM, Vinson Lee wrote:
> Fix resource leak defect reported by Coverity.
>
> Signed-off-by: Vinson Lee <vlee at freedesktop.org>
> ---
>   tests/spec/arb_direct_state_access/getcompressedtextureimage.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/tests/spec/arb_direct_state_access/getcompressedtextureimage.c b/tests/spec/arb_direct_state_access/getcompressedtextureimage.c
> index 734ef72..0d862a5 100644
> --- a/tests/spec/arb_direct_state_access/getcompressedtextureimage.c
> +++ b/tests/spec/arb_direct_state_access/getcompressedtextureimage.c
> @@ -101,6 +101,7 @@ make_layer_data(int num_layers)
>   		GLubyte *data = piglit_rgbw_image_ubyte(IMAGE_WIDTH,
>   							IMAGE_HEIGHT, true);
>   		memcpy(layer_data + IMAGE_SIZE * z, data, IMAGE_SIZE);
> +		free(data);
>   	}
>
>   	/* Show the first layer of the completed layer data. */
>

Actually, I believe the piglit_rgbw_image_ubyte() call could be moved 
outside of the loop.  It's kind of inefficient to regenerate the same 
image for every loop iteration.

-Brian



More information about the Piglit mailing list