aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2012-04-09 14:14:20 -0500
committerCharles Kerr <charles.kerr@canonical.com>2012-04-09 14:14:20 -0500
commit7a5b5a693c25cac5ca547d4e0f834c017cacf837 (patch)
tree98c51ca9e522c780df735aaf549bc612a94b622f
parent6305fe39d22fed20516756f53168c73b9383a4f3 (diff)
downloadayatana-indicator-power-7a5b5a693c25cac5ca547d4e0f834c017cacf837.tar.gz
ayatana-indicator-power-7a5b5a693c25cac5ca547d4e0f834c017cacf837.tar.bz2
ayatana-indicator-power-7a5b5a693c25cac5ca547d4e0f834c017cacf837.zip
leak fix 2 of 3: fix leaky fallback GIcon in get_device_icon()
-rw-r--r--src/indicator-power.c7
1 files 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;
}