summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEgbert Eich <eich@freedesktop.org>2011-05-19 17:16:19 +0200
committerEgbert Eich <eich@freedesktop.org>2012-11-30 08:48:00 -0500
commit5212bbe8156e935658ebcbfdd8e0120ca4947112 (patch)
treeeb2bb2acf973c7f80283d34a6ff81582a981ffb1
parentda69add8425b1bd098a96c9873a2e7ed2bd1bae0 (diff)
Add missing UnlockDisplay() and SyncHandle() to some error paths.
Without unlocking the display the application will hang if the code goes into one of the error paths. Signed-off-by: Egbert Eich <eich@freedesktop.org> Reviewed-by: Matt Turner <mattst88@gmail.com>
-rw-r--r--src/XF86Misc.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/XF86Misc.c b/src/XF86Misc.c
index 3287602..438ea18 100644
--- a/src/XF86Misc.c
+++ b/src/XF86Misc.c
@@ -147,6 +147,8 @@ Bool XF86MiscGetMouseSettings(Display* dpy, XF86MiscMouseSettings *mouseinfo)
if (!(mouseinfo->device = Xcalloc(rep.devnamelen + 1, 1))) {
_XEatData(dpy, (rep.devnamelen+3) & ~3);
Xfree(mouseinfo->device);
+ UnlockDisplay(dpy);
+ SyncHandle();
return False;
}
_XReadPad(dpy, mouseinfo->device, rep.devnamelen);
@@ -291,6 +293,8 @@ Bool XF86MiscGetFilePaths(Display* dpy, XF86MiscFilePaths *filpaths)
if (!(filpaths->configfile = Xcalloc(rep.configlen + 1, 1))) {
_XEatData(dpy, ((rep.configlen+3) & ~3) + ((rep.modulelen+3) & ~3)
+ ((rep.loglen+3) & ~3));
+ UnlockDisplay(dpy);
+ SyncHandle();
return False;
}
}
@@ -301,6 +305,8 @@ Bool XF86MiscGetFilePaths(Display* dpy, XF86MiscFilePaths *filpaths)
+ ((rep.loglen+3) & ~3));
if (filpaths->configfile)
Xfree(filpaths->configfile);
+ UnlockDisplay(dpy);
+ SyncHandle();
return False;
}
}
@@ -313,6 +319,8 @@ Bool XF86MiscGetFilePaths(Display* dpy, XF86MiscFilePaths *filpaths)
Xfree(filpaths->configfile);
if (filpaths->modulepath)
Xfree(filpaths->modulepath);
+ UnlockDisplay(dpy);
+ SyncHandle();
return False;
}
}
@@ -374,6 +382,8 @@ Status XF86MiscPassMessage(Display* dpy, int screen,
if (rep.mesglen) {
if (!(*retmsg = Xcalloc(rep.mesglen + 1, 1))) {
_XEatData(dpy, ((rep.mesglen+3) & ~3));
+ UnlockDisplay(dpy);
+ SyncHandle();
return BadAlloc;
}
_XReadPad(dpy, *retmsg, rep.mesglen);