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

Vinson Lee vlee at kemper.freedesktop.org
Tue Nov 24 06:04:23 UTC 2009


Module: Mesa
Branch: mesa_7_7_branch
Commit: 364070b1f2b08d43fb205ec198894a35bec6b2f3
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=364070b1f2b08d43fb205ec198894a35bec6b2f3

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.

---

 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