[Mesa-dev] [PATCH 3/9] egl: fix uninitialized values

Brian Paul brianp at vmware.com
Mon Apr 2 07:42:39 PDT 2012


On 04/01/2012 04:24 PM, nobled wrote:
> Noticed by clang:
>
> eglimage.c:48:28: warning: argument to 'sizeof' in 'memset' call is
> the same expression as the destination; did you mean to dereference
> it? [-Wsizeof-pointer-memaccess]
>     memset(attrs, 0, sizeof(attrs));
>            ~~~~~            ^~~~~
>
> NOTE: This is a candidate for the 8.0 branch.
> ---
>   src/egl/main/eglimage.c |    2 +-
>   1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/src/egl/main/eglimage.c b/src/egl/main/eglimage.c
> index d5deae7..1174d0a 100644
> --- a/src/egl/main/eglimage.c
> +++ b/src/egl/main/eglimage.c
> @@ -45,7 +45,7 @@ _eglParseImageAttribList(_EGLImageAttribs *attrs,
> _EGLDisplay *dpy,
>
>      (void) dpy;
>
> -   memset(attrs, 0, sizeof(attrs));
> +   memset(attrs, 0, sizeof(*attrs));
>      attrs->ImagePreserved = EGL_FALSE;
>      attrs->GLTextureLevel = 0;
>      attrs->GLTextureZOffset = 0;

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


More information about the mesa-dev mailing list