core: fix leak of generated connection if device is active

Don't generate (and add to settings) a connection if we aren't going
to use it anyway.
This commit is contained in:
Dan Williams 2014-12-03 14:24:18 -06:00
parent 5dd48f7527
commit 3cf2fbbf47

View file

@ -1656,6 +1656,10 @@ recheck_assume_connection (NMDevice *device, gpointer user_data)
if (nm_device_get_unmanaged_flag (device, NM_UNMANAGED_USER))
return FALSE;
state = nm_device_get_state (device);
if (state > NM_DEVICE_STATE_DISCONNECTED)
return FALSE;
connection = get_existing_connection (self, device, &generated);
if (!connection) {
nm_log_dbg (LOGD_DEVICE, "(%s): can't assume; no connection",
@ -1663,11 +1667,6 @@ recheck_assume_connection (NMDevice *device, gpointer user_data)
return FALSE;
}
state = nm_device_get_state (device);
if (state > NM_DEVICE_STATE_DISCONNECTED)
return FALSE;
if (state == NM_DEVICE_STATE_UNMANAGED) {
was_unmanaged = TRUE;
nm_device_state_changed (device,