summaryrefslogtreecommitdiff
path: root/src/XISelEv.c
diff options
context:
space:
mode:
authorMichal Srb <msrb@suse.com>2014-11-01 20:00:51 +0200
committerPeter Hutterer <peter.hutterer@who-t.net>2014-11-03 15:28:35 +1000
commit22ae8d4f26e92b17e1ce8239a38481933d6f1ca7 (patch)
treecd8cb5789e84ea3ec0f97fbf721bc994176cb1ac /src/XISelEv.c
parent71a42145b678be623e30bd5bf55833a04f14376f (diff)
Fix double unlock when _XiCheckExtInit return -1.
_XiCheckExtInit unlocks the display if it fails and returns -1. Most callers account for it properly, but few didn't. Signed-off-by: Michal Srb <msrb@suse.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'src/XISelEv.c')
-rw-r--r--src/XISelEv.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/XISelEv.c b/src/XISelEv.c
index 55c0a6a..aeee1e3 100644
--- a/src/XISelEv.c
+++ b/src/XISelEv.c
@@ -60,7 +60,7 @@ XISelectEvents(Display* dpy, Window win, XIEventMask* masks, int num_masks)
LockDisplay(dpy);
if (_XiCheckExtInit(dpy, XInput_2_0, info) == -1) {
r = NoSuchExtension;
- goto out;
+ goto out_unlocked;
}
for (i = 0; i < num_masks; i++) {
@@ -114,6 +114,7 @@ XISelectEvents(Display* dpy, Window win, XIEventMask* masks, int num_masks)
free(buff);
out:
UnlockDisplay(dpy);
+out_unlocked:
SyncHandle();
return r;
@@ -134,7 +135,7 @@ XIGetSelectedEvents(Display* dpy, Window win, int *num_masks_return)
*num_masks_return = -1;
LockDisplay(dpy);
if (_XiCheckExtInit(dpy, XInput_2_0, info) == -1)
- goto out;
+ goto out_unlocked;
GetReq(XIGetSelectedEvents, req);
@@ -209,6 +210,8 @@ out:
Xfree(mask_in);
UnlockDisplay(dpy);
+
+out_unlocked:
SyncHandle();
return mask_out;