glx: Fix another use-after-free problem
authorKristian Høgsberg <krh@bitplanet.net>
Thu, 9 Sep 2010 12:06:40 +0000 (08:06 -0400)
committerKristian Høgsberg <krh@bitplanet.net>
Thu, 9 Sep 2010 12:06:51 +0000 (08:06 -0400)
src/glx/glx_pbuffer.c

index d1cb66b87cac825d6fa0f3b8b40775f8c6aebb83..34892e8b1a2bcb34573dbfbc1651254a30c05066 100644 (file)
@@ -220,12 +220,14 @@ DestroyDRIDrawable(Display *dpy, GLXDrawable drawable, int destroy_xdrawable)
 {
    struct glx_display *const priv = __glXInitialize(dpy);
    __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable);
+   XID xid;
 
    if (pdraw != NULL) {
+      xid = pdraw->xDrawable;
       (*pdraw->destroyDrawable) (pdraw);
       __glxHashDelete(priv->drawHash, drawable);
       if (destroy_xdrawable)
-         XFreePixmap(pdraw->psc->dpy, pdraw->xDrawable);
+         XFreePixmap(priv->dpy, xid);
    }
 }