agent-manager: memleak: unref the last agent for a request too

==29353== 620 (+620) (32 (+32) direct, 588 (+588) indirect) bytes in 1 (+1) blocks are definitely lost in loss record 6,905 of 7,076
==29353==    at 0x7CDBAC8: g_type_create_instance (gtype.c:1844)
==29353==    by 0x7CBF356: g_object_new_internal (gobject.c:1774)
==29353==    by 0x7CC0D4C: g_object_newv (gobject.c:1922)
==29353==    by 0x7CC14E3: g_object_new (gobject.c:1614)
==29353==    by 0x50B58A: nm_secret_agent_new (nm-secret-agent.c:489)
==29353==    by 0x50915F: impl_agent_manager_register_with_capabilities (nm-agent-manager.c:309)
==29353==    by 0x62649BE: invoke_object_method (dbus-gobject.c:1899)
==29353==    by 0x62649BE: object_registration_message (dbus-gobject.c:2161)
==29353==    by 0x649D5CE: _dbus_object_tree_dispatch_and_unlock (dbus-object-tree.c:1018)
==29353==    by 0x648F193: dbus_connection_dispatch (dbus-connection.c:4718)
==29353==    by 0x6261DB4: message_queue_dispatch (dbus-gmain.c:90)
==29353==    by 0x7F44AEA: g_main_dispatch (gmain.c:3111)
==29353==    by 0x7F44AEA: g_main_context_dispatch (gmain.c:3710)
==29353==    by 0x7F44E87: g_main_context_iterate.isra.29 (gmain.c:3781)
This commit is contained in:
Lubomir Rintel 2015-02-18 17:06:46 +01:00
parent da5c332151
commit 7d706daf3e

View file

@ -318,6 +318,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.");
@ -585,11 +586,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);
@ -599,7 +601,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 */