[PATCH] agent: The reply of the error callback might be NULL

2014-08-06 Thread Tomasz Bursztyka
This fixes a crash when calling connman_agent_cancel(), where
agent_finalize_pending() is called with a NULL reply which is then used
in the callback.
---
 src/agent.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/src/agent.c b/src/agent.c
index 37cf524..90ff670 100644
--- a/src/agent.c
+++ b/src/agent.c
@@ -350,6 +350,9 @@ static void report_error_reply(DBusMessage *reply, void 
*user_data)
bool retry = false;
const char *dbus_err;
 
+   if (!reply)
+   goto out;
+
if (dbus_message_get_type(reply) == DBUS_MESSAGE_TYPE_ERROR) {
dbus_err = dbus_message_get_error_name(reply);
if (dbus_err 
@@ -360,6 +363,7 @@ static void report_error_reply(DBusMessage *reply, void 
*user_data)
 
report_error-callback(report_error-user_context, retry,
report_error-user_data);
+out:
g_free(report_error);
 }
 
-- 
1.8.5.5

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


Re: [PATCH] agent: The reply of the error callback might be NULL

2014-08-06 Thread Patrik Flykt
On Wed, 2014-08-06 at 13:11 +0300, Tomasz Bursztyka wrote:
 This fixes a crash when calling connman_agent_cancel(), where
 agent_finalize_pending() is called with a NULL reply which is then used
 in the callback.

Applied, thanks!

Patrik

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman