Mesa (mesa_7_6_branch): dri: Fix potential null pointer deference in dri_put_drawable.

Vinson Lee vlee at kemper.freedesktop.org
Sun Dec 6 09:01:37 UTC 2009


Module: Mesa
Branch: mesa_7_6_branch
Commit: f622b649fb0c55b1640997f9d32ea327743519a1
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f622b649fb0c55b1640997f9d32ea327743519a1

Author: Vinson Lee <vlee at vmware.com>
Date:   Tue Nov 24 00:57:55 2009 -0500

dri: Fix potential null pointer deference in dri_put_drawable.
(cherry picked from commit 364070b1f2b08d43fb205ec198894a35bec6b2f3)

---

 src/mesa/drivers/dri/common/dri_util.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c
index e48e10d..439f66a 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -498,11 +498,11 @@ static void dri_put_drawable(__DRIdrawable *pdp)
 {
     __DRIscreenPrivate *psp;
 
-    pdp->refcount--;
-    if (pdp->refcount)
-	return;
-
     if (pdp) {
+	pdp->refcount--;
+	if (pdp->refcount)
+	    return;
+
 	psp = pdp->driScreenPriv;
         (*psp->DriverAPI.DestroyBuffer)(pdp);
 	if (pdp->pClipRects) {




More information about the mesa-commit mailing list