aboutsummaryrefslogtreecommitdiffstats
path: root/main/libxxf86vm/0001-When-Xcalloc-returns-NULL-you-don-t-need-to-Xfree-it.patch
blob: cd5b67a977c9747a20f7b571f80be2c042e144d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
From ef95f1c3737d9efc7d97fb1784f80ef3540a846b Mon Sep 17 00:00:00 2001
From: Alan Coopersmith <alan.coopersmith@oracle.com>
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 <alan.coopersmith@oracle.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
---
 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