summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHwankyu Jhun <h.jhun@samsung.com>2020-10-30 14:13:19 +0900
committerHwankyu Jhun <h.jhun@samsung.com>2020-10-30 14:19:38 +0900
commit701a7c57f174fbedf5a8e6463bc779fc6b5ed24c (patch)
tree843b17684f3f0e9f84b139c4d95d5feddb420800
parentb04257990c3bf16a364d8a2bea725fab84413aab (diff)
downloadnotification-701a7c57f174fbedf5a8e6463bc779fc6b5ed24c.tar.gz
notification-701a7c57f174fbedf5a8e6463bc779fc6b5ed24c.tar.bz2
notification-701a7c57f174fbedf5a8e6463bc779fc6b5ed24c.zip
Fix memory leak related to gdbus method call
Change-Id: I5b853f53378472eb3003dc7f13f9f86ab991fc4f Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
-rw-r--r--notification-ex/dbus_sender.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/notification-ex/dbus_sender.cc b/notification-ex/dbus_sender.cc
index b41f384..ba0d8f9 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<Bundle> DBusSender::Request(const IEventInfo& info) {
if (!reply)
return ret_list;
+ auto reply_ptr = std::unique_ptr<GDBusMessage, decltype(g_object_unref)*>(
+ 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<GDBusMessage, decltype(g_object_unref)*>(
+ reply, g_object_unref);
+
GError* err = nullptr;
if (g_dbus_message_to_gerror(reply, &err)) {
LOGE("RequestNumber got error %s", err->message);