[Piglit] [PATCH] copy-pixels: Fix memory leak.

Anuj Phogat anuj.phogat at gmail.com
Thu Jul 14 17:48:04 UTC 2016


On Wed, Jul 13, 2016 at 4:26 PM, Vinson Lee <vlee at freedesktop.org> wrote:
> Fix resource leak defect reported by Coverity.
>
> CID: 1363040
> Fixes: 3529e325ff98 ("Rewrite copy-pixels test")
> Signed-off-by: Vinson Lee <vlee at freedesktop.org>
> ---
>  tests/general/copy-pixels.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/tests/general/copy-pixels.c b/tests/general/copy-pixels.c
> index 308868612fa8..cff1cb65adeb 100644
> --- a/tests/general/copy-pixels.c
> +++ b/tests/general/copy-pixels.c
> @@ -47,10 +47,10 @@ test_color_copypix(int x, int y)
>         bool pass = true;
>         GLuint tex;
>
> -       const float *expected = piglit_rgbw_image(GL_RGBA,
> -                                                 IMAGE_WIDTH, IMAGE_HEIGHT,
> -                                                 GL_FALSE, /* alpha */
> -                                                 GL_UNSIGNED_NORMALIZED);
> +       float *expected = piglit_rgbw_image(GL_RGBA,
> +                                           IMAGE_WIDTH, IMAGE_HEIGHT,
> +                                           GL_FALSE, /* alpha */
> +                                           GL_UNSIGNED_NORMALIZED);
>
>         /* Initialize color data */
>         tex = piglit_rgbw_texture(GL_RGBA, IMAGE_WIDTH, IMAGE_HEIGHT,
> @@ -65,6 +65,7 @@ test_color_copypix(int x, int y)
>         glCopyPixels(0, 0, IMAGE_WIDTH, IMAGE_HEIGHT, GL_COLOR);
>         pass = piglit_probe_image_color(x, y, IMAGE_WIDTH, IMAGE_HEIGHT,
>                                         GL_RGBA, expected) && pass;
> +       free(expected);
>         return pass;
>  }
>
> --
> 2.7.4
>
Reviewed-by: Anuj Phogat <anuj.phogat at gmail.com>


More information about the Piglit mailing list