Commit ef151c3f authored by Dan Williams's avatar Dan Williams
Browse files

core: fix memory leak

get_virtual_iface_name() returns an allocated interface name which
we must free; that wasn't being done when attempting to find the
interface for which a virtual interface needs to be created.  Also
throw in a cleanup for the given-device-doesn't-exist case just to
make it clearer when the interface name is freed.
parent ac654330
......@@ -2758,6 +2758,7 @@ nm_manager_activate_connection (NMManager *manager,
NMDevice *master_device = NULL;
NMConnection *master_connection = NULL;
NMActiveConnection *master_ac = NULL, *ac = NULL;
gboolean matched;
g_return_val_if_fail (manager != NULL, NULL);
g_return_val_if_fail (connection != NULL, NULL);
......@@ -2803,13 +2804,15 @@ nm_manager_activate_connection (NMManager *manager,
"Failed to determine connection's virtual interface name");
return NULL;
} else if (g_strcmp0 (iface, nm_device_get_ip_iface (device)) != 0) {
matched = g_str_equal (iface, nm_device_get_ip_iface (device));
g_free (iface);
if (!matched) {
"Device given by path did not match connection's virtual interface name");
g_free (iface);
return NULL;
g_free (iface);
} else {
/* Virtual connections (VLAN, bond, etc) may not specify a device
......@@ -2831,6 +2834,7 @@ nm_manager_activate_connection (NMManager *manager,
device = find_device_by_ip_iface (manager, iface);
g_free (iface);
if (!device) {
/* Create it */
device = system_create_virtual_device (manager, connection);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment