kdbus: Fix memory leakage in capture_org_freedesktop_DBus_StartServiceByName() 54/199754/1 accepted/tizen/5.0/unified/20190215.055148 submit/tizen_5.0/20190214.113007
authorsanghyeok.oh <sanghyeok.oh@samsung.com>
Thu, 14 Feb 2019 11:04:56 +0000 (20:04 +0900)
committerHyotaek Shim <hyotaek.shim@samsung.com>
Thu, 14 Feb 2019 11:20:39 +0000 (11:20 +0000)
Change-Id: If4b04d0f287e199e809cdf183ce4ce779c0f4dd4
Signed-off-by: sanghyeok.oh <sanghyeok.oh@samsung.com>
(cherry picked from commit 2cf07634b2d8db329055d3b9c987695e3154df60)

dbus/dbus-transport-kdbus.c

index e9b0035..626c2a7 100755 (executable)
@@ -2367,7 +2367,11 @@ capture_org_freedesktop_DBus_StartServiceByName (DBusTransportKdbus *transport,
 
       dbus_message_lock (sub_message);
 
-      if (kdbus_write_msg_internal (transport, sub_message, name, NULL, FALSE) == -1)
+      ret = kdbus_write_msg_internal (transport, sub_message, name, NULL, FALSE);
+
+      dbus_message_unref (sub_message);
+
+      if (ret == -1)
           return NULL;
       else
         {
@@ -4004,7 +4008,7 @@ kdbus_do_iteration (DBusTransport *transport,
     * error messages are inserted directly to incoming queue and
     * application hangs on dbus_poll.
     *
-    * This causes a busy loop in _dbus_connection_block_pending_call() 
+    * This causes a busy loop in _dbus_connection_block_pending_call()
     * There is no case of waiting for the locally-generated error reply
 
    if (_dbus_connection_get_n_incoming (transport->connection) > 0)