From 4f656c7052b04cf3432a45ae4c042ac084f8d2d3 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Fri, 21 Sep 2012 15:08:03 +0300 Subject: [PATCH] network: Fix DBusMessage leaks --- profiles/network/connection.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/profiles/network/connection.c b/profiles/network/connection.c index 9773b7b0c..7688beb44 100644 --- a/profiles/network/connection.c +++ b/profiles/network/connection.c @@ -158,9 +158,13 @@ static void cancel_connection(struct network_conn *nc, const char *err_msg) nc->watch = 0; } - if (nc->msg && err_msg) { - reply = btd_error_failed(nc->msg, err_msg); - g_dbus_send_message(conn, reply); + if (nc->msg) { + if (err_msg) { + reply = btd_error_failed(nc->msg, err_msg); + g_dbus_send_message(conn, reply); + } + dbus_message_unref(nc->msg); + nc->msg = NULL; } g_io_channel_shutdown(nc->io, TRUE, NULL); @@ -270,6 +274,8 @@ static gboolean bnep_setup_cb(GIOChannel *chan, GIOCondition cond, g_dbus_send_reply(btd_get_dbus_connection(), nc->msg, DBUS_TYPE_STRING, &pdev, DBUS_TYPE_INVALID); + dbus_message_unref(nc->msg); + nc->msg = NULL; connected = TRUE; emit_property_changed(nc->peer->path, -- 2.47.3