From f55f2a3e68afb2160690768dd8b2a0c8cdf5c787 Mon Sep 17 00:00:00 2001 From: "abitha.s" Date: Wed, 28 Jun 2017 18:54:18 +0530 Subject: [PATCH] [IOT-2412]Segment faults in ResourceContainerImpl function is calling erase on the map container which will invalidate it. Hence, added guard calls. Change-Id: I555895089d8dfa0a3a7f0d804dd5ccef8e4e1ece Signed-off-by: abitha.s Reviewed-on: https://gerrit.iotivity.org/gerrit/21097 Tested-by: jenkins-iotivity Reviewed-by: Uze Choi --- service/resource-container/src/ResourceContainerImpl.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/service/resource-container/src/ResourceContainerImpl.cpp b/service/resource-container/src/ResourceContainerImpl.cpp index 8fd9a56..1360ad2 100644 --- a/service/resource-container/src/ResourceContainerImpl.cpp +++ b/service/resource-container/src/ResourceContainerImpl.cpp @@ -126,10 +126,12 @@ namespace OIC activationLock.lock(); for (std::map< std::string, shared_ptr >::iterator it = m_bundles.begin(); - it != m_bundles.end(); ++it) + it != m_bundles.end();) { + auto next_itr = std::next (it, 1); deactivateBundle(it->second); unregisterBundle(it->second); + it = next_itr; } if (!m_mapServers.empty()) -- 2.7.4