summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2013-04-13 17:52:12 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2013-04-15 14:38:16 -0700
commit8ed00bd0a7c44c7fece687e2566d920ea74ef809 (patch)
treec88d4f02ee150cd8ceb20356bb0ff7ade040a5fc
parenta89b1ad3377bfef9bab52f15f98b00f6540d531a (diff)
Unlock display before returning alloc error in XF86VidModeGetModeLine()
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--src/XF86VMode.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/XF86VMode.c b/src/XF86VMode.c
index 165f8ba..28c79c1 100644
--- a/src/XF86VMode.c
+++ b/src/XF86VMode.c
@@ -203,6 +203,7 @@ XF86VidModeGetModeLine(Display* dpy, int screen, int* dotclock,
xXF86OldVidModeGetModeLineReply oldrep;
xXF86VidModeGetModeLineReq *req;
int majorVersion, minorVersion;
+ Bool result = True;
XF86VidModeCheckExtension (dpy, info, False);
XF86VidModeQueryVersion(dpy, &majorVersion, &minorVersion);
@@ -254,17 +255,18 @@ XF86VidModeGetModeLine(Display* dpy, int screen, int* dotclock,
}
if (modeline->privsize > 0) {
- if (!(modeline->private = Xcalloc(modeline->privsize, sizeof(INT32)))) {
+ modeline->private = Xcalloc(modeline->privsize, sizeof(INT32));
+ if (modeline->private == NULL) {
_XEatData(dpy, (modeline->privsize) * sizeof(INT32));
- return False;
- }
- _XRead(dpy, (char*)modeline->private, modeline->privsize * sizeof(INT32));
+ result = False;
+ } else
+ _XRead(dpy, (char*)modeline->private, modeline->privsize * sizeof(INT32));
} else {
modeline->private = NULL;
}
UnlockDisplay(dpy);
SyncHandle();
- return True;
+ return result;
}
Bool