[Piglit] [PATCH] draw-pixels: Ensure allocPixels returns an initialized value.

Brian Paul brian.e.paul at gmail.com
Fri Dec 7 06:42:36 PST 2012


On Fri, Dec 7, 2012 at 12:02 AM, Vinson Lee <vlee at freedesktop.org> wrote:
> Fixes uninitialized pointer read defect reported by Coverity.
>
> Signed-off-by: Vinson Lee <vlee at freedesktop.org>
> ---
>  tests/general/draw-pixels.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/tests/general/draw-pixels.c b/tests/general/draw-pixels.c
> index 36e0cd6..5871876 100644
> --- a/tests/general/draw-pixels.c
> +++ b/tests/general/draw-pixels.c
> @@ -278,6 +278,11 @@ allocPixels(GLenum format, GLenum type, GLuint components)
>                         }
>                 }
>                 break;
> +
> +       default:
> +               assert(0);

An assert like assert(!"Unexpected data type") would be a bit more
useful, but not a big deal.

> +               pixels = NULL;
> +               break;
>         }
>         return pixels;
>  }

Reviewed-by: Brian Paul <brianp at vmware.com>


More information about the Piglit mailing list