From 06feef78296f3a2d3a5a3d1f653d38e7bf122015 Mon Sep 17 00:00:00 2001 From: raveit65 Date: Tue, 14 Jul 2020 11:33:08 +0200 Subject: batstatt: fix deprecated up_client_get_devices The previous code would have leaked all the UpDevice objects because no free function was set on the returned GPtrArray. With depending on upower-glib 0.99.8 get_devices() was deprecated and get_devices2() was introduced, we can simply switch to get_devices2() which does set a free function on the returned GPtrArray, stopping the leak. --- battstat/battstat-upower.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'battstat') diff --git a/battstat/battstat-upower.c b/battstat/battstat-upower.c index c22d50c7..2e8b4b4c 100644 --- a/battstat/battstat-upower.c +++ b/battstat/battstat-upower.c @@ -89,7 +89,7 @@ battstat_upower_initialise (void (*callback) (void)) #if UP_CHECK_VERSION(0, 99, 0) GPtrArray *devices; - devices = up_client_get_devices(upc); + devices = up_client_get_devices2 (upc); if (!devices) { goto error_shutdownclient; } @@ -149,7 +149,7 @@ void battstat_upower_get_battery_info( BatteryStatus *status ) { - GPtrArray *devices = up_client_get_devices( upc ); + GPtrArray *devices = up_client_get_devices2 (upc); /* The calculation to get overall percentage power remaining is as follows: * -- cgit v1.2.1