glx: Fix memory leak if XF86DRICreateDrawable() fails
authorVinson Lee <vlee@vmware.com>
Mon, 2 Nov 2009 19:35:47 +0000 (12:35 -0700)
committerBrian Paul <brianp@vmware.com>
Mon, 2 Nov 2009 19:35:47 +0000 (12:35 -0700)
Signed-off-by: Brian Paul <brianp@vmware.com>
src/glx/x11/dri_glx.c

index ab24bd8ffe111651478579ad463a06070c52d388..4f7acb6cc32958890af720f95a2c9282f24ca497 100644 (file)
@@ -596,8 +596,10 @@ driCreateDrawable(__GLXscreenConfigs * psc,
    pdraw->drawable = drawable;
    pdraw->psc = psc;
 
-   if (!XF86DRICreateDrawable(psc->dpy, psc->scr, drawable, &hwDrawable))
+   if (!XF86DRICreateDrawable(psc->dpy, psc->scr, drawable, &hwDrawable)) {
+      Xfree(pdraw);
       return NULL;
+   }
 
    /* Create a new drawable */
    pdraw->driDrawable =