LaunchAppCommand: resolve possible memory leak
authorJongmin Lee <jm105.lee@samsung.com>
Tue, 9 Jun 2020 06:16:26 +0000 (15:16 +0900)
committerJongmin Lee <jm105.lee@samsung.com>
Thu, 11 Jun 2020 22:02:32 +0000 (07:02 +0900)
Change-Id: I22bd2fbdafbcb51b3a08fae8309a213809cdc742

org.tizen.aurum-bootstrap/src/Commands/LaunchAppCommand.cc

index 86326eb..f611eb5 100644 (file)
@@ -34,6 +34,7 @@ LaunchAppCommand::LaunchAppCommand(const ::aurum::ReqLaunchApp* request,
     if (ret) {
         LOG_SCOPE_F(INFO, "Launch Failed(2/3) Err Code : %ull", ret);
         mResponse->set_status(::aurum::RspStatus::ERROR);
+        app_control_destroy(appControl);
         return grpc::Status::OK;
     }
 
@@ -41,8 +42,11 @@ LaunchAppCommand::LaunchAppCommand(const ::aurum::ReqLaunchApp* request,
     if (ret) {
         LOG_SCOPE_F(INFO, "Launch Failed(3/3) Err Code : %ull", ret);
         mResponse->set_status(::aurum::RspStatus::ERROR);
+        app_control_destroy(appControl);
         return grpc::Status::OK;
     }
+
+    app_control_destroy(appControl);
 #endif
     return grpc::Status::OK;
 }
@@ -51,4 +55,4 @@ LaunchAppCommand::LaunchAppCommand(const ::aurum::ReqLaunchApp* request,
     LOG_SCOPE_F(INFO, "LaunchAppCommand::executePost");
     std::this_thread::sleep_for(std::chrono::milliseconds{2500});
     return grpc::Status::OK;
-}
\ No newline at end of file
+}