mirror of
https://gitlab.freedesktop.org/upower/upower.git
synced 2026-01-03 20:40:09 +01:00
lib: Fix memory leak in up_client_get_devices()
When up_client_get_devices() fails to contact the D-Bus daemon, don't leak the newly created array.
This commit is contained in:
parent
95e8a2a316
commit
fe37183fba
1 changed files with 2 additions and 2 deletions
|
|
@ -95,8 +95,6 @@ up_client_get_devices (UpClient *client)
|
|||
|
||||
g_return_val_if_fail (UP_IS_CLIENT (client), NULL);
|
||||
|
||||
array = g_ptr_array_new ();
|
||||
|
||||
if (up_client_glue_call_enumerate_devices_sync (client->priv->proxy,
|
||||
&devices,
|
||||
NULL,
|
||||
|
|
@ -106,6 +104,8 @@ up_client_get_devices (UpClient *client)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
array = g_ptr_array_new ();
|
||||
|
||||
for (i = 0; devices[i] != NULL; i++) {
|
||||
UpDevice *device;
|
||||
const char *object_path = devices[i];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue