glx: Add missing null check in dri2CreateDrawable
authorJuha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Mon, 16 Dec 2013 14:04:00 +0000 (07:04 -0700)
committerBrian Paul <brianp@vmware.com>
Wed, 18 Dec 2013 16:06:52 +0000 (09:06 -0700)
Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
src/glx/dri2_glx.c

index bfeebed9dd6b4bf8f22f69ad538f0923ca384c18..309c1e7d733b41ebadece0d1d42e3fddbc4f1588 100644 (file)
@@ -366,6 +366,10 @@ dri2CreateDrawable(struct glx_screen *base, XID xDrawable,
    struct dri2_display *pdp;
    GLint vblank_mode = DRI_CONF_VBLANK_DEF_INTERVAL_1;
 
+   dpyPriv = __glXInitialize(psc->base.dpy);
+   if (dpyPriv == NULL)
+      return NULL;
+
    pdraw = calloc(1, sizeof(*pdraw));
    if (!pdraw)
       return NULL;
@@ -395,8 +399,6 @@ dri2CreateDrawable(struct glx_screen *base, XID xDrawable,
    }
 
    DRI2CreateDrawable(psc->base.dpy, xDrawable);
-
-   dpyPriv = __glXInitialize(psc->base.dpy);
    pdp = (struct dri2_display *)dpyPriv->dri2Display;;
    /* Create a new drawable */
    pdraw->driDrawable =