dri: Fix potential null pointer dereference in driBindContext.
authorVinson Lee <vlee@vmware.com>
Sun, 29 Nov 2009 04:22:31 +0000 (23:22 -0500)
committerVinson Lee <vlee@vmware.com>
Sun, 6 Dec 2009 09:01:55 +0000 (01:01 -0800)
(cherry picked from commit 919898e92fa23ff71a59d86a46ff0886a6f34e4d)

src/mesa/drivers/dri/common/dri_util.c

index 439f66a7b882de1c996b1ea271c84e129788a6c0..da81ec9de510ece000cca5f5f003ac9590122ce1 100644 (file)
@@ -167,11 +167,12 @@ static int driBindContext(__DRIcontext *pcp,
                          __DRIdrawable *pdp,
                          __DRIdrawable *prp)
 {
-    __DRIscreenPrivate *psp = pcp->driScreenPriv;
+    __DRIscreenPrivate *psp;
 
     /* Bind the drawable to the context */
 
     if (pcp) {
+       psp = pcp->driScreenPriv;
        pcp->driDrawablePriv = pdp;
        pcp->driReadablePriv = prp;
        if (pdp) {