diff --git a/profiles/network/connection.c b/profiles/network/connection.c
index 9773b7b..7688beb 100644
--- a/profiles/network/connection.c
+++ b/profiles/network/connection.c
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);
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,