[Mesa-dev] [PATCH] glx: Add missing null check in glXCreateContextAttribsARB

Brian Paul brianp at vmware.com
Mon Jan 13 17:36:31 PST 2014


On 01/13/2014 05:35 AM, Juha-Pekka Heikkila wrote:
> Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
> ---
>   src/glx/create_context.c | 3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/src/glx/create_context.c b/src/glx/create_context.c
> index 38e949a..b15921f 100644
> --- a/src/glx/create_context.c
> +++ b/src/glx/create_context.c
> @@ -90,6 +90,9 @@ glXCreateContextAttribsARB(Display *dpy, GLXFBConfig config,
>   #endif
>      }
>
> +   if (gc == NULL)
> +      return NULL;
> +
>      gc->xid = xcb_generate_id(c);
>      gc->share_xid = (share != NULL) ? share->xid : 0;

I think this new check could be moved up into the previous if (gc == 
NULL) block.  As-is, we're testing the same condition twice all the time.

-Brian




More information about the mesa-dev mailing list