Fix memory leak 44/246444/2
authorhyunho <hhstark.kang@samsung.com>
Thu, 29 Oct 2020 10:42:21 +0000 (19:42 +0900)
committerHwanKyu Jhun <h.jhun@samsung.com>
Fri, 30 Oct 2020 04:47:28 +0000 (04:47 +0000)
Change-Id: I91519afe7a367266bbaf5bf160c4965c4ce54225
Signed-off-by: hyunho <hhstark.kang@samsung.com>
notification-ex/stub.cc

index 2f3300c..7d523e6 100644 (file)
@@ -1072,8 +1072,9 @@ extern "C" EXPORT_API int noti_ex_item_group_foreach_child(noti_ex_item_h handle
   list<shared_ptr<AbstractItem>> children = p->GetChildren();
   LOGI("Retrive (%zd)", children.size());
   for (auto i : children) {
+    Handle handle(i);
     int ret = callback(
-        static_cast<noti_ex_item_h>(new Handle(i)), data);
+        static_cast<noti_ex_item_h>(&handle), data);
     if (ret != NOTI_EX_ERROR_NONE) {
       LOGW("callback return (%d) stop foreach", ret);
       break;