fpi-device: Fix a small leak when configuring the wakeup

This commit is contained in:
Marco Trevisan (Treviño)
2022-09-27 17:36:09 +02:00
parent 171e65f73f
commit 62f2f34655

View File

@@ -1720,7 +1720,7 @@ fpi_device_configure_wakeup (FpDevice *device, gboolean enabled)
g_autoptr(GString) ports = NULL; g_autoptr(GString) ports = NULL;
GUsbDevice *dev, *parent; GUsbDevice *dev, *parent;
const char *wakeup_command = enabled ? "enabled" : "disabled"; const char *wakeup_command = enabled ? "enabled" : "disabled";
guint8 bus, port; guint8 bus;
g_autofree gchar *sysfs_wakeup = NULL; g_autofree gchar *sysfs_wakeup = NULL;
g_autofree gchar *sysfs_persist = NULL; g_autofree gchar *sysfs_persist = NULL;
int res; int res;
@@ -1732,8 +1732,12 @@ fpi_device_configure_wakeup (FpDevice *device, gboolean enabled)
dev = priv->usb_device; dev = priv->usb_device;
while ((parent = g_usb_device_get_parent (dev))) while ((parent = g_usb_device_get_parent (dev)))
{ {
g_autofree gchar *port_str = NULL;
guint8 port;
port = g_usb_device_get_port_number (dev); port = g_usb_device_get_port_number (dev);
g_string_prepend (ports, g_strdup_printf ("%d.", port)); port_str = g_strdup_printf ("%d.", port);
g_string_prepend (ports, port_str);
dev = parent; dev = parent;
} }
g_string_set_size (ports, ports->len - 1); g_string_set_size (ports, ports->len - 1);