mirror of
https://gitlab.freedesktop.org/upower/upower.git
synced 2025-12-20 06:40:04 +01:00
linux: up-device-supply: fix the resource leak
1. free the udev parent node automatically. 2. free new_model_name variable in the same scope.
This commit is contained in:
parent
d79841fe40
commit
c5df437cc1
1 changed files with 6 additions and 3 deletions
|
|
@ -331,7 +331,9 @@ static void
|
||||||
up_device_supply_sibling_discovered_guess_type (UpDevice *device,
|
up_device_supply_sibling_discovered_guess_type (UpDevice *device,
|
||||||
GObject *sibling)
|
GObject *sibling)
|
||||||
{
|
{
|
||||||
GUdevDevice *input, *native_device, *parent_device, *parent_sibling;
|
GUdevDevice *input, *native_device;
|
||||||
|
g_autoptr (GUdevDevice) parent_device = NULL;
|
||||||
|
g_autoptr (GUdevDevice) parent_sibling = NULL;
|
||||||
UpDeviceKind cur_type, new_type;
|
UpDeviceKind cur_type, new_type;
|
||||||
gboolean is_same_parent = FALSE;
|
gboolean is_same_parent = FALSE;
|
||||||
char *new_model_name;
|
char *new_model_name;
|
||||||
|
|
@ -492,9 +494,10 @@ up_device_supply_sibling_discovered_guess_type (UpDevice *device,
|
||||||
"type", new_type,
|
"type", new_type,
|
||||||
"model", new_model_name,
|
"model", new_model_name,
|
||||||
NULL);
|
NULL);
|
||||||
g_free (new_model_name);
|
} else {
|
||||||
} else
|
|
||||||
g_object_set (device, "type", new_type, NULL);
|
g_object_set (device, "type", new_type, NULL);
|
||||||
|
}
|
||||||
|
g_free (new_model_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue