On 12/11/2013 02:06 AM, Juha-Pekka Heikkila wrote:
Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikk...@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

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to