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

Ian Romanick idr at freedesktop.org
Fri Jun 20 18:33:19 PDT 2014


On 06/19/2014 05:24 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 | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/src/glx/glx_pbuffer.c b/src/glx/glx_pbuffer.c
> index 8f48093..322f241 100644
> --- a/src/glx/glx_pbuffer.c
> +++ b/src/glx/glx_pbuffer.c
> @@ -319,7 +319,6 @@ GetDrawableAttribute(Display * dpy, GLXDrawable drawable,
>     pdraw = GetGLXDRIDrawable(dpy, drawable);
>  
>     if (attribute == GLX_BACK_BUFFER_AGE_EXT) {
> -      struct glx_screen *psc = pdraw->psc;
>        struct glx_context *gc = __glXGetCurrentContext();
>  
>        /* The GLX_EXT_buffer_age spec says:
> @@ -328,12 +327,16 @@ GetDrawableAttribute(Display * dpy, GLXDrawable drawable,
>         *   the calling thread's current context a GLXBadDrawable error is
>         *   generated."
>         */
> -      if (gc == NULL || gc->currentDpy != dpy ||
> -         (gc->currentDrawable != drawable && gc->currentReadable != drawable)) {
> -         __glXSendError(dpy, GLXBadDrawable, drawable, X_GLXGetDrawableAttributes, false);
> +      if (pdraw == NULL || gc == NULL || gc->currentDpy != dpy ||
> +         (gc->currentDrawable != drawable &&
> +         gc->currentReadable != drawable)) {
> +         __glXSendError(dpy, GLXBadDrawable, drawable,
> +                        X_GLXGetDrawableAttributes, false);
>           return 0;
>        }
>  
> +      struct glx_screen *psc = pdraw->psc;
> +

Can't mix code and declarations in this part of Mesa. :(  With that
fixed, this patch is

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

>        if (psc->driScreen->getBufferAge != NULL)
>           *value = psc->driScreen->getBufferAge(pdraw);
>  



More information about the mesa-dev mailing list