Fix memory leak 02/112002/1
authorseungha.son <seungha.son@samsung.com>
Wed, 25 Jan 2017 08:09:23 +0000 (17:09 +0900)
committerseungha.son <seungha.son@samsung.com>
Wed, 25 Jan 2017 08:35:15 +0000 (17:35 +0900)
 - If body is floating, memory corruption is occured when msg get body
   in g_dbus_connection_send_message_with_reply()
   So, this problem can be solved by increase reference count of body
   when body is floating.

Signed-off-by: seungha.son <seungha.son@samsung.com>
Change-Id: Ifaffa3153b111d91a8e20c6ad5c9e228548983c9

src/notification_ipc.c

index 4bc536369e0a05db62370de80c672fc3f28216c5..4c90f585104925651ed273bcc4e75367f4f37bd3 100755 (executable)
@@ -792,6 +792,9 @@ static int _send_async_noti(GVariant *body, result_cb_item *cb_item, char *cmd)
                /* LCOV_EXCL_STOP */
        }
 
+       if (g_variant_is_floating(body))
+               g_variant_ref(body);
+
        if (body != NULL)
                g_dbus_message_set_body(msg, body);
 
@@ -805,6 +808,9 @@ static int _send_async_noti(GVariant *body, result_cb_item *cb_item, char *cmd)
                        (GAsyncReadyCallback)_send_message_with_reply_async_cb,
                        cb_item);
 
+       if (msg)
+               g_object_unref(msg);
+
        NOTIFICATION_DBG("_send_async_noti done !!");
        return NOTIFICATION_ERROR_NONE;
 }