From 1dacc7d60c9ec5cadd0999f25ab17889f9bff4c4 Mon Sep 17 00:00:00 2001 From: Harry Date: Wed, 31 Jan 2018 14:52:21 +0530 Subject: [PATCH] [CONPRO-1212] Removing invocation of lock_guard destructor. std::lock_guard follows RAII for std::mutex. Invoking std::lock_guard::~lock_guard() makes unlock call twice on underlying mutex. As per the API documentation calling unlock from thread which does not own lock results in undefined behaviour. https://github.sec.samsung.net/RS7-IOTIVITY/IoTivity/pull/243 (cherry picked from commit fc681e089d3bbbbd16f90ad05d53208f9a1602d1) Change-Id: I56512847cb3411db81bd93eb55a4dc1c34a25d83 Signed-off-by: Harry Signed-off-by: Amit KS --- .../src/resourceCache/src/ResourceCacheManager.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/service/resource-encapsulation/src/resourceCache/src/ResourceCacheManager.cpp b/service/resource-encapsulation/src/resourceCache/src/ResourceCacheManager.cpp index 386e809..efe0cde 100644 --- a/service/resource-encapsulation/src/resourceCache/src/ResourceCacheManager.cpp +++ b/service/resource-encapsulation/src/resourceCache/src/ResourceCacheManager.cpp @@ -134,7 +134,6 @@ namespace OIC if ((dataCacheIns == cacheIDmap.end() && observeIns == observeCacheIDmap.end()) || id == 0) { - lock.~lock_guard(); throw RCSInvalidParameterException {"[cancelResourceCache] CacheID is invaild"}; } @@ -148,7 +147,6 @@ namespace OIC { (observeIns->second).reset(); observeCacheIDmap.erase(id); - lock.~lock_guard(); throw; } (observeIns->second).reset(); -- 2.7.4