[Mesa-dev] [PATCH 5/5] glx: Add missing null check in dri2CreateDrawable
Brian Paul
brianp at vmware.com
Wed Dec 11 17:17:20 PST 2013
On 12/11/2013 02:06 AM, Juha-Pekka Heikkila wrote:
> Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
> ---
> src/glx/dri2_glx.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
> index bfeebed..e553004 100644
> --- a/src/glx/dri2_glx.c
> +++ b/src/glx/dri2_glx.c
> @@ -397,6 +397,12 @@ dri2CreateDrawable(struct glx_screen *base, XID xDrawable,
> DRI2CreateDrawable(psc->base.dpy, xDrawable);
>
> dpyPriv = __glXInitialize(psc->base.dpy);
> + if (dpyPriv == NULL) {
> + DRI2DestroyDrawable(psc->base.dpy, xDrawable);
> + free(pdraw);
> + return NULL;
> + }
> +
> pdp = (struct dri2_display *)dpyPriv->dri2Display;;
> /* Create a new drawable */
> pdraw->driDrawable =
>
How about just moving the __glXInitialize() call to the top of the
function and doing an earely return there? Then you wouldn't have to
bother with the free/destroy calls.
-Brian
More information about the mesa-dev
mailing list