From dbdf44bdfe6665e34ce1adb4e7fd44f2c7f08d5c Mon Sep 17 00:00:00 2001 From: Rajeev Kuthiravattath Date: Sun, 11 Jul 2010 11:48:24 +0300 Subject: [PATCH] obexd: fix DBusPendingCall handle leak --- obexd/plugins/nokia-backup.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/obexd/plugins/nokia-backup.c b/obexd/plugins/nokia-backup.c index 00b9d5abe..dffc5cd23 100644 --- a/obexd/plugins/nokia-backup.c +++ b/obexd/plugins/nokia-backup.c @@ -151,19 +151,21 @@ static gboolean send_backup_dbus_message(const char *oper, DBUS_TYPE_INT32, &file_size, DBUS_TYPE_INVALID); - ret = dbus_connection_send_with_reply(conn, msg, &pending_call, - BACKUP_DBUS_TIMEOUT); - - dbus_message_unref(msg); - - if (ret && (strcmp(oper, "open") == 0)) { - obj->conn = conn; - obj->pending_call = pending_call; - ret = dbus_pending_call_set_notify(pending_call, + if (strcmp(oper, "open") == 0) { + ret = dbus_connection_send_with_reply(conn, msg, &pending_call, + BACKUP_DBUS_TIMEOUT); + dbus_message_unref(msg); + if (ret) { + obj->conn = conn; + obj->pending_call = pending_call; + ret = dbus_pending_call_set_notify(pending_call, on_backup_dbus_notify, obj, NULL); + } else + dbus_connection_unref(conn); } else { - dbus_pending_call_unref(pending_call); + ret = dbus_connection_send(conn, msg, NULL); + dbus_message_unref(msg); dbus_connection_unref(conn); } -- 2.47.3