[PATCH] mouse: plug minor memory leak.



If no synaptics device was found, the version field was never freed.
Plug this leak by forcing a single exit path.

Signed-off-by: Peter Hutterer <peter hutterer who-t net>
---
 panels/mouse/gnome-mouse-properties.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/panels/mouse/gnome-mouse-properties.c b/panels/mouse/gnome-mouse-properties.c
index 98be9a0..48255af 100644
--- a/panels/mouse/gnome-mouse-properties.c
+++ b/panels/mouse/gnome-mouse-properties.c
@@ -221,7 +221,7 @@ find_synaptics (void)
 {
 	gboolean ret = FALSE;
 	int numdevices, i;
-	XDeviceInfo *devicelist;
+	XDeviceInfo *devicelist = NULL;
 	Atom realtype, prop;
 	int realformat;
 	unsigned long nitems, bytes_after;
@@ -232,13 +232,12 @@ find_synaptics (void)
 	version = XGetExtensionVersion (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), "XInputExtension");
 	if (!version->present ||
 		(version->major_version * 1000 + version->minor_version) < 1005) {
-		XFree (version);
-		return False;
+		goto out;
 	}
 
 	prop = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), "Synaptics Off", True);
 	if (!prop)
-		return False;
+		goto out;
 
 	devicelist = XListInputDevices (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), &numdevices);
 	for (i = 0; i < numdevices; i++) {
@@ -266,6 +265,7 @@ find_synaptics (void)
 			breakr
 	yndaemon -k ignored modifier keys only, not keyboard 
        combinations with modifier keys. Use -K instead, so combos like 
        Ctrl+C/Ctrl+V for copy/paste can be used without a halting touchpad.

 
+out:
 	XFree (version);
 	XFreeDeviceList (devicelist);
 
-- 
1.7.3.4



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