diff --git a/src/settings/nm-agent-manager.c b/src/settings/nm-agent-manager.c index cc4b1943ca..8dcda06db7 100644 --- a/src/settings/nm-agent-manager.c +++ b/src/settings/nm-agent-manager.c @@ -330,6 +330,7 @@ impl_agent_manager_register_with_capabilities (NMAgentManager *self, priv->chains = g_slist_append (priv->chains, chain); } else { + g_object_unref (agent); error = g_error_new_literal (NM_AGENT_MANAGER_ERROR, NM_AGENT_MANAGER_ERROR_FAILED, "Unable to start agent authentication."); @@ -602,11 +603,12 @@ request_next_agent (Request *req) { GError *error = NULL; + req->current_call_id = NULL; + if (req->current) + g_object_unref (req->current); + if (req->pending) { /* Send the request to the next agent */ - req->current_call_id = NULL; - if (req->current) - g_object_unref (req->current); req->current = req->pending->data; req->pending = g_slist_remove (req->pending, req->current); @@ -616,7 +618,6 @@ request_next_agent (Request *req) req->next_callback (req); } else { - req->current_call_id = NULL; req->current = NULL; /* No more secret agents are available to fulfill this secrets request */