[PATCH 13/15] xkb: Check if AddResource failed

Pauli Nieminen ext-pauli.nieminen at nokia.com
Tue Jul 27 05:09:54 PDT 2010


Signed-off-by: Pauli Nieminen <ext-pauli.nieminen at nokia.com>
---
 xkb/xkb.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/xkb/xkb.c b/xkb/xkb.c
index 452bf2c..618d0bc 100644
--- a/xkb/xkb.c
+++ b/xkb/xkb.c
@@ -224,7 +224,8 @@ ProcXkbSelectEvents(ClientPtr client)
     masks = XkbFindClientResource((DevicePtr)dev,client);
     if (!masks){
 	XID id = FakeClientID(client->index);
-	AddResource(id,RT_XKBCLIENT,dev);
+	if (!AddResource(id,RT_XKBCLIENT,dev))
+	    return BadAlloc;
 	masks= XkbAddClientResource((DevicePtr)dev,client,id);
     }
     if (masks) {
@@ -5386,7 +5387,8 @@ ProcXkbPerClientFlags(ClientPtr client)
 	}
 	else if (want && (!interest)) {
 	    XID id = FakeClientID(client->index);
-	    AddResource(id,RT_XKBCLIENT,dev);
+	    if (!AddResource(id,RT_XKBCLIENT,dev))
+		return BadAlloc;
 	    interest= XkbAddClientResource((DevicePtr)dev,client,id);
 	    if (!interest)
 		return BadAlloc;
-- 
1.6.3.3



More information about the xorg-devel mailing list