From: Hwankyu Jhun Date: Fri, 30 Oct 2020 05:13:19 +0000 (+0900) Subject: Fix memory leak related to gdbus method call X-Git-Tag: submit/tizen/20201102.032450~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=701a7c57f174fbedf5a8e6463bc779fc6b5ed24c;p=platform%2Fcore%2Fapi%2Fnotification.git Fix memory leak related to gdbus method call Change-Id: I5b853f53378472eb3003dc7f13f9f86ab991fc4f Signed-off-by: Hwankyu Jhun --- diff --git a/notification-ex/dbus_sender.cc b/notification-ex/dbus_sender.cc index b41f384c..ba0d8f97 100644 --- a/notification-ex/dbus_sender.cc +++ b/notification-ex/dbus_sender.cc @@ -140,6 +140,7 @@ GDBusMessage* DBusSender::Impl::MethodCall(string appid, string method_name, g_error_free(err); } + g_object_unref(msg); return reply; } @@ -186,6 +187,7 @@ GDBusMessage* DBusSender::Impl::MethodCall(string appid, const IEventInfo& info, } g_variant_builder_unref(builder); + g_object_unref(msg); return reply; } @@ -234,6 +236,9 @@ std::list DBusSender::Request(const IEventInfo& info) { if (!reply) return ret_list; + auto reply_ptr = std::unique_ptr( + reply, g_object_unref); + GError* err = nullptr; if (g_dbus_message_to_gerror(reply, &err)) { LOGE("Request got error %s", err->message); @@ -274,6 +279,9 @@ int DBusSender::RequestNumber(const IEventInfo& info) { if (!reply) return 0; + auto reply_ptr = std::unique_ptr( + reply, g_object_unref); + GError* err = nullptr; if (g_dbus_message_to_gerror(reply, &err)) { LOGE("RequestNumber got error %s", err->message);