From 7d3742525c4b0b2d3f5e417a716c1db056c08243 Mon Sep 17 00:00:00 2001 From: Vinicius Costa Gomes Date: Mon, 14 Jul 2008 15:39:59 -0300 Subject: [PATCH] obexd: There were some segfaults with asynchronous agents. --- obexd/src/manager.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/obexd/src/manager.c b/obexd/src/manager.c index 4c72ff63f..74834f7f6 100644 --- a/obexd/src/manager.c +++ b/obexd/src/manager.c @@ -432,6 +432,10 @@ static void agent_reply(DBusPendingCall *call, gpointer user_data) const gchar *name; DBusError derr; + /* Received a reply after the agent exited */ + if (!agent) + return; + agent->auth_pending = FALSE; dbus_error_init(&derr); @@ -542,7 +546,7 @@ int request_authorization(gint32 cid, int fd, const gchar *filename, dbus_pending_call_set_notify(call, agent_reply, NULL, NULL); /* Workaround: process events while agent doesn't reply */ - while (agent->auth_pending) + while (agent && agent->auth_pending) g_main_context_iteration(NULL, TRUE); g_source_remove(watch); @@ -550,7 +554,7 @@ int request_authorization(gint32 cid, int fd, const gchar *filename, dbus_pending_call_cancel(call); dbus_pending_call_unref(call); - if (!agent->new_name) { + if (!agent || !agent->new_name) { return -EPERM; } -- 2.47.3