Fix double free 17/219117/1
authorJusung Son <jusung07.son@samsung.com>
Mon, 2 Dec 2019 06:27:57 +0000 (15:27 +0900)
committerJusung Son <jusung07.son@samsung.com>
Mon, 2 Dec 2019 06:27:57 +0000 (15:27 +0900)
Change-Id: I96fe552053fe04ea5b4f3613e80fcdfb457219cd
Signed-off-by: Jusung Son <jusung07.son@samsung.com>
notification-ex/stub.cc

index 14dab89..0f0d6d6 100644 (file)
@@ -337,7 +337,15 @@ extern "C" EXPORT_API int noti_ex_action_app_control_get(
   shared_ptr<AbstractAction>* ptr =
       static_cast<shared_ptr<AbstractAction>*>(handle);
   AppControlAction* action = static_cast<AppControlAction*>(ptr->get());
-  *app_control = action->GetAppControl();
+
+  app_control_h clone;
+  int r = app_control_clone(&clone, action->GetAppControl());
+  if (r != APP_CONTROL_ERROR_NONE) {
+    LOGE("failed to create a app_control handle : %d", r);
+    return NOTI_EX_ERROR_INVALID_PARAMETER;
+  }
+
+  *app_control = clone;
 
   return NOTI_EX_ERROR_NONE;
 }