Fix a static analysis issue 64/297264/4
authorChanggyu Choi <changyu.choi@samsung.com>
Wed, 16 Aug 2023 05:36:27 +0000 (14:36 +0900)
committerChanggyu Choi <changyu.choi@samsung.com>
Wed, 16 Aug 2023 06:20:05 +0000 (15:20 +0900)
Adds app_status nullptr checking.

Change-Id: I473c9c9a752641410ce21124bc2ec86bda2b8e6a
Signed-off-by: Changgyu Choi <changyu.choi@samsung.com>
src/lib/amd_launch.cc
src/lib/boot_sequencer/boot_sequencer.cc

index a71767d..4cb26fd 100644 (file)
@@ -1506,6 +1506,11 @@ int _terminate_app_local(uid_t uid, int pid) {
   }
 
   amd::AppStatusPtr app_status = amd::AppStatusManager::GetInst().Find(pid);
+  if (app_status == nullptr) {
+    _W("Failed to find app status. pid(%d)", pid);
+    return -1;
+  }
+
   SendAppTerminateRequestSignal(app_status);
   int ret = amd::AppRequest::Terminate(pid, req.get());
   if (ret == 0) {
index 091d133..a263d29 100644 (file)
@@ -594,6 +594,11 @@ int BootSequencer::OnLaunchAppStartEnd(const char* msg, int arg1, int arg2,
     void* arg3, bundle* arg4) {
   pid_t pid = arg1;
   AppStatusPtr app_status = AppStatusManager::GetInst().Find(pid);
+  if (app_status == nullptr) {
+    _W("Failed to find app status. pid(%d)", pid);
+    return NOTI_CONTINUE;
+  }
+
   std::string appid = app_status->GetAppID();
   uid_t uid = app_status->GetUID();
   auto app_info = BootSequencer::GetInst().Lookup(appid, uid);