[PATCH 3/3] CheckPassiveGrabsOnWindow() needs to handle NULL return value from AllocGrab()

Alan Coopersmith alan.coopersmith at oracle.com
Mon Jan 6 17:10:40 PST 2014


CheckPassiveGrabsOnWindow() calls AllocGrab() which can fail and return NULL.
This return value is not checked, and can cause NULL pointer dereferences.

Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
 dix/events.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/dix/events.c b/dix/events.c
index 2f0605e..acf97cc 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -3956,6 +3956,8 @@ CheckPassiveGrabsOnWindow(WindowPtr pWin,
         return NULL;
 
     tempGrab = AllocGrab(NULL);
+    if (tempGrab == NULL)
+        return NULL;
 
     /* Fill out the grab details, but leave the type for later before
      * comparing */
-- 
1.7.9.2



More information about the xorg-devel mailing list