From ef95f1c3737d9efc7d97fb1784f80ef3540a846b Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sat, 13 Apr 2013 15:13:06 -0700 Subject: [PATCH 1/8] When Xcalloc() returns NULL, you don't need to Xfree() it I have no words to explain how this ever happened. Signed-off-by: Alan Coopersmith Reviewed-by: Peter Hutterer --- src/XF86VMode.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/XF86VMode.c b/src/XF86VMode.c index 4f19cf3..c0e50e6 100644 --- a/src/XF86VMode.c +++ b/src/XF86VMode.c @@ -256,7 +256,6 @@ XF86VidModeGetModeLine(Display* dpy, int screen, int* dotclock, if (modeline->privsize > 0) { if (!(modeline->private = Xcalloc(modeline->privsize, sizeof(INT32)))) { _XEatData(dpy, (modeline->privsize) * sizeof(INT32)); - Xfree(modeline->private); return False; } _XRead(dpy, (char*)modeline->private, modeline->privsize * sizeof(INT32)); @@ -321,7 +320,6 @@ XF86VidModeGetAllModeLines(Display* dpy, int screen, int* modecount, _XEatData(dpy, (rep.modecount) * sizeof(xXF86OldVidModeModeInfo)); else _XEatData(dpy, (rep.modecount) * sizeof(xXF86VidModeModeInfo)); - Xfree(modelines); return False; } mdinfptr = (XF86VidModeModeInfo *) ( @@ -353,7 +351,6 @@ XF86VidModeGetAllModeLines(Display* dpy, int screen, int* modecount, if (!(modelines[i]->private = Xcalloc(oldxmdline.privsize, sizeof(INT32)))) { _XEatData(dpy, (oldxmdline.privsize) * sizeof(INT32)); - Xfree(modelines[i]->private); } else { _XRead(dpy, (char*)modelines[i]->private, oldxmdline.privsize * sizeof(INT32)); @@ -384,7 +381,6 @@ XF86VidModeGetAllModeLines(Display* dpy, int screen, int* modecount, if (!(modelines[i]->private = Xcalloc(xmdline.privsize, sizeof(INT32)))) { _XEatData(dpy, (xmdline.privsize) * sizeof(INT32)); - Xfree(modelines[i]->private); } else { _XRead(dpy, (char*)modelines[i]->private, xmdline.privsize * sizeof(INT32)); @@ -1039,7 +1035,6 @@ XF86VidModeGetDotClocks(Display* dpy, int screen, int *flagsPtr, if (!(dotclocks = (int*) Xcalloc(rep.clocks, sizeof(int)))) { _XEatData(dpy, (rep.clocks) * 4); - Xfree(dotclocks); return False; } -- 1.8.2.3