[PATCH libXrandr 2/2] fix: redundant null check on calling free()

walter harms wharms at bfs.de
Thu Jul 28 17:32:46 UTC 2016


janitorial patch: remove some unneeded if() before free()

---
 src/XrrMonitor.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/XrrMonitor.c b/src/XrrMonitor.c
index 71d3943..f45ea04 100644
--- a/src/XrrMonitor.c
+++ b/src/XrrMonitor.c
@@ -84,8 +84,8 @@ XRRGetMonitors(Display *dpy, Window window, Bool get_active, int *nmonitors)
 	mon = Xmalloc (rbytes);

 	if (buf == NULL || mon == NULL) {
-	    if (buf != NULL) Xfree(buf);
-	    if (mon != NULL) Xfree(mon);
+	    Xfree(buf);
+	    Xfree(mon);
 	    _XEatDataWords (dpy, rep.length);
 	    UnlockDisplay (dpy);
 	    SyncHandle ();
@@ -194,7 +194,6 @@ XRRAllocateMonitor(Display *dpy, int noutput)
 void
 XRRFreeMonitors(XRRMonitorInfo *monitors)
 {
-    if (monitors)
 	Xfree(monitors);
 }

-- 
2.1.4



More information about the xorg-devel mailing list