GrabDevice() calls AllocGrab() which can fail and return NULL.
This return value is not checked, and can cause NULL pointer dereferences.
Reported-by: Ilja Van Sprundel <ivansprundel@ioactive.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
* @param other_mode GrabModeSync or GrabModeAsync
* @param status Return code to be returned to the caller.
*
- * @returns Success or BadValue.
+ * @returns Success or BadValue or BadAlloc.
*/
int
GrabDevice(ClientPtr client, DeviceIntPtr dev,
GrabPtr tempGrab;
tempGrab = AllocGrab(NULL);
+ if (tempGrab == NULL)
+ return BadAlloc;
tempGrab->next = NULL;
tempGrab->window = pWin;