File U_XIGrabDevice-Unlock-display-in-error-path.patch of Package libXi.5236

From: Michal Srb <msrb@suse.com>
Date: Mon Nov 3 12:43:40 2014 +0200
Subject: [PATCH]XIGrabDevice: Unlock display in error path.
Patch-mainline: Upstream
Git-commit: c648441036cf5ffc5225cd484e2c906d374f0a4b
Git-repo: git://anongit.freedesktop.org/git/xorg/lib/libXi
References: bnc#940529
Signed-off-by: Egbert Eich <eich@suse.com>

Signed-off-by: Michal Srb <msrb@suse.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
---
 src/XIGrabDevice.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/XIGrabDevice.c b/src/XIGrabDevice.c
index a8c5697..22f4ea1 100644
--- a/src/XIGrabDevice.c
+++ b/src/XIGrabDevice.c
@@ -53,14 +53,20 @@ XIGrabDevice(Display* dpy, int deviceid, Window grab_window, Time time,
 
     if (mask->mask_len > INT_MAX - 3 ||
         (mask->mask_len + 3)/4 >= 0xffff)
-        return BadValue;
+    {
+        reply.status = BadValue;
+        goto out;
+    }
 
     /* mask->mask_len is in bytes, but we need 4-byte units on the wire,
      * and they need to be padded with 0 */
     len = (mask->mask_len + 3)/4;
     buff = calloc(4, len);
     if (!buff)
-        return BadAlloc;
+    {
+        reply.status =  BadAlloc;
+        goto out;
+    }
 
     GetReq(XIGrabDevice, req);
     req->reqType  = extinfo->codes->major_opcode;
@@ -83,6 +89,7 @@ XIGrabDevice(Display* dpy, int deviceid, Window grab_window, Time time,
     if (_XReply(dpy, (xReply *)&reply, 0, xTrue) == 0)
 	reply.status = GrabSuccess;
 
+out:
     UnlockDisplay(dpy);
     SyncHandle();
openSUSE Build Service is sponsored by