diff options
author | Peter Wu <peter@lekensteyn.nl> | 2014-11-18 22:01:51 +0100 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2014-11-26 11:56:15 +0000 |
commit | a91d03a3a9310b5d00e65a249aab2241906733bc (patch) | |
tree | beea5529bc8b86b651bb1d2624209ad009cf78b3 /src/linux/up-device-supply.c | |
parent | 4221835fae97f875a23d0ce449e955f2ea488bbc (diff) | |
download | upower-a91d03a3a9310b5d00e65a249aab2241906733bc.tar.gz |
daemon: fix various reference leaks
up_daemon_get_daemon takes a reference on UpDaemon, so it must be
properly dereferenced. Similar for up_daemon_get_devices_list which
references an UpDeviceList.
The display device was allocated in init, but never released either.
https://bugs.freedesktop.org/show_bug.cgi?id=82659
Diffstat (limited to 'src/linux/up-device-supply.c')
-rw-r--r-- | src/linux/up-device-supply.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/linux/up-device-supply.c b/src/linux/up-device-supply.c index ad86ede..94bc615 100644 --- a/src/linux/up-device-supply.c +++ b/src/linux/up-device-supply.c @@ -511,6 +511,7 @@ up_device_supply_refresh_battery (UpDeviceSupply *supply, gboolean ac_online = FALSE; gboolean has_ac = FALSE; gboolean online; + UpDeviceList *devices_list; GPtrArray *devices; guint i; @@ -699,7 +700,8 @@ up_device_supply_refresh_battery (UpDeviceSupply *supply, /* If we have any online AC, assume charging, otherwise * discharging */ - devices = up_device_list_get_array (up_daemon_get_device_list (daemon)); + devices_list = up_daemon_get_device_list (daemon); + devices = up_device_list_get_array (devices_list); for (i=0; i < devices->len; i++) { if (up_device_get_online ((UpDevice *) g_ptr_array_index (devices, i), &online)) { has_ac = TRUE; @@ -710,6 +712,7 @@ up_device_supply_refresh_battery (UpDeviceSupply *supply, } } g_ptr_array_unref (devices); + g_object_unref (devices_list); if (has_ac) { if (ac_online) { |