[PATCH 1/2] xfree86: dri2: check for drawable value

Tiago Vignatti tiago.vignatti at nokia.com
Tue Jun 29 09:00:16 PDT 2010


Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
---
I'm not exactly seeing any problem or segfault with this code. I just got this
issue with the static analyzer.

 hw/xfree86/dri2/dri2.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index f9ba8e7..d4181c9 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -734,6 +734,11 @@ Bool
 DRI2WaitSwap(ClientPtr client, DrawablePtr pDrawable)
 {
     DRI2DrawablePtr pPriv = DRI2GetDrawable(pDrawable);
+    if (pPriv == NULL) {
+        xf86DrvMsg(pScreen->myNum, X_ERROR,
+		   "[DRI2] %s: bad drawable\n", __func__);
+	return;
+    }
 
     /* If we're currently waiting for a swap on this drawable, reset
      * the request and suspend the client.  We only support one
-- 
1.7.1.226.g770c5



More information about the xorg-devel mailing list