[gnome-settings-daemon/gnome-3-4] wacom: Fix memleak in find_output_by_display()



commit 21a52c806ff7ca672804826b78788294eb1cde75
Author: Bastien Nocera <hadess hadess net>
Date:   Fri May 25 13:22:06 2012 +0100

    wacom: Fix memleak in find_output_by_display()

 plugins/wacom/gsd-wacom-device.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/plugins/wacom/gsd-wacom-device.c b/plugins/wacom/gsd-wacom-device.c
index bafc3b4..95e5c6c 100644
--- a/plugins/wacom/gsd-wacom-device.c
+++ b/plugins/wacom/gsd-wacom-device.c
@@ -572,23 +572,31 @@ find_output_by_display (GsdWacomDevice *device)
 	GSettings *tablet;
 	GVariant *display;
 	const gchar **edid;
+	GnomeRROutputInfo *ret;
 
 	if (device == NULL)
 		return NULL;
 
+	ret      = NULL;
 	tablet   = device->priv->wacom_settings;
 	display  = g_settings_get_value (tablet, "display");
 	edid     = g_variant_get_strv (display, &n);
 
 	if (n != 3) {
 		g_critical ("Expected 'display' key to store %d values; got %"G_GSIZE_FORMAT".", 3, n);
-		return NULL;
+		goto out;
 	}
 
 	if (strlen(edid[0]) == 0 || strlen(edid[1]) == 0 || strlen(edid[2]) == 0)
-		return NULL;
+		goto out;
 
-	return find_output_by_edid (edid[0], edid[1], edid[2]);
+	ret = find_output_by_edid (edid[0], edid[1], edid[2]);
+
+out:
+	g_free (edid);
+	g_variant_unref (display);
+
+	return ret;
 }
 
 static GnomeRROutputInfo*



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