From 3cf2fbbf47dbb6a2f7a077b84d7bb50374f83f27 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Wed, 3 Dec 2014 14:24:18 -0600 Subject: [PATCH] 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. --- src/nm-manager.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/nm-manager.c b/src/nm-manager.c index 2636cc4b93..1c946ec41a 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -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,