aboutsummaryrefslogtreecommitdiff
path: root/src/indicator-power.c
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2012-03-17 14:45:06 -0500
committerCharles Kerr <charles.kerr@canonical.com>2012-03-17 14:45:06 -0500
commita9ab1c3e64481d4ea4cd6d540b0dc75b055193d1 (patch)
tree6d8c1011cdca02da2337d53d20afdffe7166f25e /src/indicator-power.c
parent04891491daee1cfe70aa7652deb09595f379153d (diff)
downloadayatana-indicator-power-a9ab1c3e64481d4ea4cd6d540b0dc75b055193d1.tar.gz
ayatana-indicator-power-a9ab1c3e64481d4ea4cd6d540b0dc75b055193d1.tar.bz2
ayatana-indicator-power-a9ab1c3e64481d4ea4cd6d540b0dc75b055193d1.zip
Fix variant leak in count_batteries() -- the returned value of g_variant_get_child_value() needs to be freed with g_variant_unref() when we're done with it.
Diffstat (limited to 'src/indicator-power.c')
-rw-r--r--src/indicator-power.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/indicator-power.c b/src/indicator-power.c
index ff56fda..d97ecdd 100644
--- a/src/indicator-power.c
+++ b/src/indicator-power.c
@@ -1040,6 +1040,8 @@ count_batteries(GVariant *devices, int *total, int *inuse)
if ((state == UP_DEVICE_STATE_CHARGING) || (state == UP_DEVICE_STATE_DISCHARGING))
++*inuse;
}
+
+ g_variant_unref (device);
}
g_debug("count_batteries found %d batteries (%d are charging/discharging)", *total, *inuse);