From 7a5b5a693c25cac5ca547d4e0f834c017cacf837 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Mon, 9 Apr 2012 14:14:20 -0500 Subject: leak fix 2 of 3: fix leaky fallback GIcon in get_device_icon() --- src/indicator-power.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/indicator-power.c b/src/indicator-power.c index 4b3f85c..9a474bd 100644 --- a/src/indicator-power.c +++ b/src/indicator-power.c @@ -512,9 +512,7 @@ get_device_icon (UpDeviceKind kind, guint64 time_sec, const gchar *device_icon) { - GIcon *gicon; - - gicon = g_icon_new_for_string (device_icon, NULL); + GIcon *gicon = NULL; if (kind == UP_DEVICE_KIND_BATTERY && (state == UP_DEVICE_STATE_FULLY_CHARGED || @@ -538,6 +536,9 @@ get_device_icon (UpDeviceKind kind, } } + if (gicon == NULL) + gicon = g_icon_new_for_string (device_icon, NULL); + return gicon; } -- cgit v1.2.3