[gnome-desktop] idle-monitor: Fix a memory leak when finding the proper IDLETIME counter



commit d56495cd15551510dd0e323d4e8232f518d1519b
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Sun Oct 28 21:57:38 2012 -0400

    idle-monitor: Fix a memory leak when finding the proper IDLETIME counter
    
    https://bugzilla.gnome.org/show_bug.cgi?id=682224

 libgnome-desktop/gnome-idle-monitor.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/libgnome-desktop/gnome-idle-monitor.c b/libgnome-desktop/gnome-idle-monitor.c
index 603f9c2..37a0dde 100644
--- a/libgnome-desktop/gnome-idle-monitor.c
+++ b/libgnome-desktop/gnome-idle-monitor.c
@@ -181,16 +181,18 @@ find_idletime_counter (Display *display)
 	int		    i;
 	int		    ncounters;
 	XSyncSystemCounter *counters;
+	XSyncCounter        counter = None;
 
 	counters = XSyncListSystemCounters (display, &ncounters);
 	for (i = 0; i < ncounters; i++) {
 		if (counters[i].name != NULL && strcmp (counters[i].name, "IDLETIME") == 0) {
-			return counters[i].counter;
+			counter = counters[i].counter;
+			break;
 		}
 	}
 	XSyncFreeSystemCounterList (counters);
 
-	return None;
+	return counter;
 }
 
 static guint32



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]