Network: Plug a memory leak

This commit is contained in:
Matthias Clasen 2011-03-25 20:12:08 -04:00
parent 158246ebab
commit 942ff4a9ad

View file

@ -1980,6 +1980,7 @@ wireless_ap_changed_cb (GtkComboBox *combo_box, CcNetworkPanel *panel)
gchar *object_path = NULL; gchar *object_path = NULL;
gchar *ssid_target = NULL; gchar *ssid_target = NULL;
GSList *list, *l; GSList *list, *l;
GSList *filtered;
GtkTreeIter iter; GtkTreeIter iter;
GtkTreeModel *model; GtkTreeModel *model;
NetObject *object; NetObject *object;
@ -2016,10 +2017,10 @@ wireless_ap_changed_cb (GtkComboBox *combo_box, CcNetworkPanel *panel)
list = nm_remote_settings_list_connections (panel->priv->remote_settings); list = nm_remote_settings_list_connections (panel->priv->remote_settings);
g_debug ("%i existing remote connections available", g_debug ("%i existing remote connections available",
g_slist_length (list)); g_slist_length (list));
list = nm_device_filter_connections (device, list); filtered = nm_device_filter_connections (device, list);
g_debug ("%i suitable remote connections to check", g_debug ("%i suitable remote connections to check",
g_slist_length (list)); g_slist_length (filtered));
for (l = list; l; l = g_slist_next (l)) { for (l = filtered; l; l = g_slist_next (l)) {
connection = NM_CONNECTION (l->data); connection = NM_CONNECTION (l->data);
setting_wireless = nm_connection_get_setting_wireless (connection); setting_wireless = nm_connection_get_setting_wireless (connection);
if (!NM_IS_SETTING_WIRELESS (setting_wireless)) if (!NM_IS_SETTING_WIRELESS (setting_wireless))
@ -2036,6 +2037,9 @@ wireless_ap_changed_cb (GtkComboBox *combo_box, CcNetworkPanel *panel)
} }
} }
g_slist_free (list);
g_slist_free (filtered);
/* activate the connection */ /* activate the connection */
if (connection_activate != NULL) { if (connection_activate != NULL) {
nm_client_activate_connection (panel->priv->client, nm_client_activate_connection (panel->priv->client,