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 9c6f552..eaa6ba2 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 88ddbec..b41f384 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;
 }