[Mesa-dev] [PATCH 10/20] glx: Added missing null check in GetDrawableAttribute()

Ian Romanick idr at freedesktop.org
Wed May 14 13:16:04 PDT 2014


On 05/14/2014 10:55 AM, Juha-Pekka Heikkila wrote:
> For GLX_BACK_BUFFER_AGE_EXT query added extra null check.
> 
> Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
> ---
>  src/glx/glx_pbuffer.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/src/glx/glx_pbuffer.c b/src/glx/glx_pbuffer.c
> index 0cd0554..bbfdd65 100644
> --- a/src/glx/glx_pbuffer.c
> +++ b/src/glx/glx_pbuffer.c
> @@ -319,6 +319,10 @@ GetDrawableAttribute(Display * dpy, GLXDrawable drawable,
>     pdraw = GetGLXDRIDrawable(dpy, drawable);
>  
>     if (attribute == GLX_BACK_BUFFER_AGE_EXT) {
> +      if (pdraw == NULL) {
> +         return 0;
> +      }
> +

This code will need more restructuring.  If pdraw is NULL, this function
should generate GLXBadDrawable (see a few lines lower in the function
than is shown in the patch).  Maybe just move the assignment of psc
lower in the function, and add a '|| pdraw == NULL' to the if-statement
below?

>        struct glx_screen *psc = pdraw->psc;
>        struct glx_context *gc = __glXGetCurrentContext();
>  
> 



More information about the mesa-dev mailing list