summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2013-04-13 17:58:28 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2013-04-15 14:38:28 -0700
commitd0355b28dd53fba6fb29c350e090ed4a73d4c480 (patch)
treede506260762ed406c5a3aa5f2068fcfee438daf7
parent6c82906f25abcb0f8ec92bcdaf1872bd8b63ca5d (diff)
Unlock display before returning alloc error in XF86VidModeGetDotClocks()
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--src/XF86VMode.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/XF86VMode.c b/src/XF86VMode.c
index 76276b6..1b907f4 100644
--- a/src/XF86VMode.c
+++ b/src/XF86VMode.c
@@ -1014,6 +1014,7 @@ XF86VidModeGetDotClocks(Display* dpy, int screen, int *flagsPtr,
xXF86VidModeGetDotClocksReq *req;
int i, *dotclocks;
CARD32 dotclk;
+ Bool result = True;
XF86VidModeCheckExtension (dpy, info, False);
@@ -1033,19 +1034,21 @@ XF86VidModeGetDotClocks(Display* dpy, int screen, int *flagsPtr,
*maxclocksPtr = rep.maxclocks;
*flagsPtr = rep.flags;
- if (!(dotclocks = (int*) Xcalloc(rep.clocks, sizeof(int)))) {
+ dotclocks = Xcalloc(rep.clocks, sizeof(int));
+ if (dotclocks == NULL) {
_XEatData(dpy, (rep.clocks) * 4);
- return False;
+ result = False;
}
-
- for (i = 0; i < rep.clocks; i++) {
- _XRead(dpy, (char*)&dotclk, 4);
- dotclocks[i] = dotclk;
+ else {
+ for (i = 0; i < rep.clocks; i++) {
+ _XRead(dpy, (char*)&dotclk, 4);
+ dotclocks[i] = dotclk;
+ }
}
*clocksPtr = dotclocks;
UnlockDisplay(dpy);
SyncHandle();
- return True;
+ return result;
}
Bool