summaryrefslogtreecommitdiff
path: root/dix
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2014-01-22 11:33:53 -0800
committerKeith Packard <keithp@keithp.com>2014-01-22 11:33:53 -0800
commit25ebb9dbc9df659dec2bf6c27654a5bad2d11f94 (patch)
tree196d71c9136106382bc74302e4d3f88523812205 /dix
parent409e8e29fbe16122ba5a4249256fc56e2e68ea93 (diff)
parent71baa466b1f6b02fe503f9a3089b7b9d61aa0f80 (diff)
Merge remote-tracking branch 'whot/for-keith'
Diffstat (limited to 'dix')
-rw-r--r--dix/events.c6
-rw-r--r--dix/grabs.c11
2 files changed, 10 insertions, 7 deletions
diff --git a/dix/events.c b/dix/events.c
index ddbd4d281..f05dada3d 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -3961,6 +3961,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 */
@@ -5056,7 +5058,7 @@ ProcUngrabPointer(ClientPtr client)
* @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,
@@ -5137,6 +5139,8 @@ GrabDevice(ClientPtr client, DeviceIntPtr dev,
GrabPtr tempGrab;
tempGrab = AllocGrab(NULL);
+ if (tempGrab == NULL)
+ return BadAlloc;
tempGrab->next = NULL;
tempGrab->window = pWin;
diff --git a/dix/grabs.c b/dix/grabs.c
index 5fd68202a..e3fc38bf5 100644
--- a/dix/grabs.c
+++ b/dix/grabs.c
@@ -199,12 +199,11 @@ AllocGrab(const GrabPtr src)
free(grab);
grab = NULL;
}
- }
-
- if (src && !CopyGrab(grab, src)) {
- free(grab->xi2mask);
- free(grab);
- grab = NULL;
+ else if (src && !CopyGrab(grab, src)) {
+ free(grab->xi2mask);
+ free(grab);
+ grab = NULL;
+ }
}
return grab;