base-manager: plug memleak

Don't g_strdup() the physdev string to store it in the hash table; instead store
the original string right away as it is already created with g_strdup_printf().

Reported by: Yunlian Jiang <yunlian@chromium.org>

https://code.google.com/p/chromium/issues/detail?id=515929
This commit is contained in:
Aleksander Morgado
2015-08-02 09:03:06 +02:00
parent 9b051b14ed
commit 0337781ba7

View File

@@ -749,9 +749,7 @@ handle_set_profile (MmGdbusTest *skeleton,
/* Create device and keep it listed in the Manager */
physdev = g_strdup_printf ("/virtual/%s", id);
device = mm_device_virtual_new (physdev, TRUE);
g_hash_table_insert (self->priv->devices,
g_strdup (physdev),
device);
g_hash_table_insert (self->priv->devices, physdev, device);
/* Grab virtual ports */
mm_device_virtual_grab_ports (device, (const gchar **)ports);