Fix invalid access 37/212137/1
authorHwankyu Jhun <h.jhun@samsung.com>
Thu, 15 Aug 2019 07:01:49 +0000 (16:01 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Thu, 15 Aug 2019 07:04:25 +0000 (16:04 +0900)
While calling Exit(), the iterator is removed.
Before calling Exit(), the iterator has to be the next iterator.

Change-Id: I36f61cafbf81442dc12a2dbe32573f24e9da7458
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
component_based/base/component_manager_internal.cc

index f2bee5bd5d76c2a881d0282866e0526e772a9a24..8bb18c10e5d5158d7547e0ff3893680d48cb4ede 100644 (file)
@@ -147,8 +147,11 @@ void ComponentManager::ExitAll() {
   if (inst_map_.empty())
     return;
 
-  for (auto i = inst_map_.begin(); i != inst_map_.end(); i++) {
+  auto iter = inst_map_.begin();
+  while (iter != inst_map_.end()) {
+    auto i = iter;
     LOGD("Exit instance(%s)", i->first.c_str());
+    iter++;
     Exit(i->first);
   }
 }