Fix segmentation fault 17/298417/1
authorHwankyu Jhun <h.jhun@samsung.com>
Wed, 6 Sep 2023 23:08:54 +0000 (08:08 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Wed, 6 Sep 2023 23:08:54 +0000 (08:08 +0900)
When user log off, amd tries to remove the app status of the list.
In this time, the problem occurs.

Change-Id: I551c472246f88138bf4e8c6bee3372905ff95d00
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/lib/app_status/app_status_manager.cc

index 908e078..2e59286 100644 (file)
@@ -556,9 +556,13 @@ void AppStatusManager::UserFinish(uid_t uid) {
   else
     _D("Watch fd doesn't exist - uid(%d)", uid);
 
-  for (auto& app_status : app_status_list_)
+  auto iter = app_status_list_.begin();
+  while (iter != app_status_list_.end()) {
+    auto app_status = *iter;
+    iter++;
     if (app_status->GetUID() == uid)
       CleanUp(app_status);
+  }
 }
 
 int AppStatusManager::RegisterPID(int pid, const std::string& appid,