Fix memory leak
authorHwankyu Jhun <h.jhun@samsung.com>
Tue, 27 Oct 2020 08:41:29 +0000 (17:41 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Tue, 27 Oct 2020 10:04:55 +0000 (19:04 +0900)
Change-Id: I652c07d13faef7ee237afdb9e886151fd9f41902
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
notification-ex/app_control_action.cc
notification-ex/dbus_sender.cc

index 9c6f5520587d87cfbda1c0b9f7b299f8633b123e..eaa6ba246472e28dd76d1d804e95ddb82df3f3de 100644 (file)
@@ -123,6 +123,9 @@ void AppControlAction::Deserialize(Bundle b) {
     return;
   }
 
+  if (impl_->control_)
+    app_control_destroy(impl_->control_);
+
   impl_->control_ = app_control;
 }
 
index 88ddbec7b9b15fe68748b85b47cd2be6c275a642..b41f384c044064ba127e03a910a829b2020eb817 100644 (file)
@@ -252,11 +252,13 @@ std::list<Bundle> DBusSender::Request(const IEventInfo& info) {
   GVariantIter *iter = nullptr;
   g_variant_get(reply_body, "(a(s))", &iter);
   char* raw = nullptr;
-  while (g_variant_iter_loop(iter, "(s)", &raw) && raw != nullptr) {
+  while (g_variant_iter_loop(iter, "(&s)", &raw) && raw != nullptr) {
     Bundle ret(raw);
     ret_list.emplace_back(ret);
   }
 
+  if (iter)
+    g_variant_iter_free(iter);
   return ret_list;
 }