From c161b85ee72a4184c7208cd8b6f6f5b487419811 Mon Sep 17 00:00:00 2001 From: "seungha.son" Date: Wed, 25 Jan 2017 17:09:23 +0900 Subject: [PATCH] Fix memory leak - 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 Change-Id: Ifaffa3153b111d91a8e20c6ad5c9e228548983c9 --- src/notification_ipc.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/notification_ipc.c b/src/notification_ipc.c index 4bc5363..4c90f58 100755 --- a/src/notification_ipc.c +++ b/src/notification_ipc.c @@ -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; } -- 2.7.4