diff options
author | marha <marha@users.sourceforge.net> | 2011-12-05 07:42:31 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-12-05 07:42:31 +0100 |
commit | 528f5bd58a139174170c4130c67dca30193c9057 (patch) | |
tree | 550c818095dbc607deaddf166c77116ccd91ef54 /xorg-server/Xi | |
parent | 2cfebffb491807a465a8e5f7daca582d8aefb829 (diff) | |
download | vcxsrv-528f5bd58a139174170c4130c67dca30193c9057.tar.gz vcxsrv-528f5bd58a139174170c4130c67dca30193c9057.tar.bz2 vcxsrv-528f5bd58a139174170c4130c67dca30193c9057.zip |
xserver xkeyboard-config mesa git update 5 dec 2011
Diffstat (limited to 'xorg-server/Xi')
-rw-r--r-- | xorg-server/Xi/exevents.c | 35 | ||||
-rw-r--r-- | xorg-server/Xi/xipassivegrab.c | 36 |
2 files changed, 48 insertions, 23 deletions
diff --git a/xorg-server/Xi/exevents.c b/xorg-server/Xi/exevents.c index 53db03629..20495e74d 100644 --- a/xorg-server/Xi/exevents.c +++ b/xorg-server/Xi/exevents.c @@ -1628,6 +1628,19 @@ SelectForWindow(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client, return Success; } +static void +FreeInputClient(InputClientsPtr *other) +{ + free(*other); + *other = NULL; +} + +static InputClientsPtr +AllocInputClient(void) +{ + return calloc(1, sizeof(InputClients)); +} + int AddExtensionClient(WindowPtr pWin, ClientPtr client, Mask mask, int mskidx) { @@ -1635,7 +1648,7 @@ AddExtensionClient(WindowPtr pWin, ClientPtr client, Mask mask, int mskidx) if (!pWin->optional && !MakeWindowOptional(pWin)) return BadAlloc; - others = calloc(1, sizeof(InputClients)); + others = AllocInputClient(); if (!others) return BadAlloc; if (!pWin->optional->inputMasks && !MakeInputMasks(pWin)) @@ -1649,7 +1662,7 @@ AddExtensionClient(WindowPtr pWin, ClientPtr client, Mask mask, int mskidx) return Success; bail: - free(others); + FreeInputClient(&others); return BadAlloc; } @@ -1665,6 +1678,13 @@ MakeInputMasks(WindowPtr pWin) return TRUE; } +static void +FreeInputMask(OtherInputMasks **imask) +{ + free(*imask); + *imask = NULL; +} + void RecalculateDeviceDeliverableEvents(WindowPtr pWin) { @@ -1721,14 +1741,15 @@ InputClientGone(WindowPtr pWin, XID id) if (other->resource == id) { if (prev) { prev->next = other->next; - free(other); + FreeInputClient(&other); } else if (!(other->next)) { if (ShouldFreeInputMasks(pWin, TRUE)) { - wOtherInputMasks(pWin)->inputClients = other->next; - free(wOtherInputMasks(pWin)); + OtherInputMasks *mask = wOtherInputMasks(pWin); + mask->inputClients = other->next; + FreeInputMask(&mask); pWin->optional->inputMasks = (OtherInputMasks *) NULL; CheckWindowOptionalNeed(pWin); - free(other); + FreeInputClient(&other); } else { other->resource = FakeClientID(0); if (!AddResource(other->resource, RT_INPUTCLIENT, @@ -1737,7 +1758,7 @@ InputClientGone(WindowPtr pWin, XID id) } } else { wOtherInputMasks(pWin)->inputClients = other->next; - free(other); + FreeInputClient(&other); } RecalculateDeviceDeliverableEvents(pWin); return Success; diff --git a/xorg-server/Xi/xipassivegrab.c b/xorg-server/Xi/xipassivegrab.c index 6be27f3d1..2f13a95e8 100644 --- a/xorg-server/Xi/xipassivegrab.c +++ b/xorg-server/Xi/xipassivegrab.c @@ -80,7 +80,6 @@ ProcXIPassiveGrabDevice(ClientPtr client) DeviceIntPtr dev, mod_dev; xXIPassiveGrabDeviceReply rep; int i, ret = Success; - uint8_t status; uint32_t *modifiers; xXIGrabModifierInfo *modifiers_failed; GrabMask mask; @@ -145,32 +144,36 @@ ProcXIPassiveGrabDevice(ClientPtr client) if (stuff->cursor != None) { - status = dixLookupResourceByType(&tmp, stuff->cursor, - RT_CURSOR, client, DixUseAccess); - if (status != Success) - { - client->errorValue = stuff->cursor; - return status; - } + ret = dixLookupResourceByType(&tmp, stuff->cursor, + RT_CURSOR, client, DixUseAccess); + if (ret != Success) + { + client->errorValue = stuff->cursor; + goto out; + } } - status = dixLookupWindow((WindowPtr*)&tmp, stuff->grab_window, client, DixSetAttrAccess); - if (status != Success) - return status; + ret = dixLookupWindow((WindowPtr*)&tmp, stuff->grab_window, client, DixSetAttrAccess); + if (ret != Success) + goto out; - status = CheckGrabValues(client, ¶m); - if (status != Success) - return status; + ret = CheckGrabValues(client, ¶m); + if (ret != Success) + goto out; modifiers = (uint32_t*)&stuff[1] + stuff->mask_len; modifiers_failed = calloc(stuff->num_modifiers, sizeof(xXIGrabModifierInfo)); - if (!modifiers_failed) - return BadAlloc; + if (!modifiers_failed) { + ret = BadAlloc; + goto out; + } mod_dev = (IsFloating(dev)) ? dev : GetMaster(dev, MASTER_KEYBOARD); for (i = 0; i < stuff->num_modifiers; i++, modifiers++) { + uint8_t status = Success; + param.modifiers = *modifiers; switch(stuff->grab_type) { @@ -208,6 +211,7 @@ ProcXIPassiveGrabDevice(ClientPtr client) WriteToClient(client, rep.length * 4, (char*)modifiers_failed); free(modifiers_failed); +out: return ret; } |