[PATCH:libXxf86vm 4/4] Unlock display before returning alloc error in XF86VidModeGetDotClocks()
Alan Coopersmith
alan.coopersmith at oracle.com
Sat Apr 13 18:48:21 PDT 2013
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
src/XF86VMode.c | 17 ++++++++++-------
1 file 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
--
1.7.9.2
More information about the xorg-devel
mailing list