summaryrefslogtreecommitdiff
path: root/zen/zstring.cpp
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 17:26:50 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 17:26:50 +0200
commit669df123648aaa6aeccc70206b5417bc48b4e9ae (patch)
tree463c107a8d6405020bb304f7a7253e6b64afeee0 /zen/zstring.cpp
parent5.18 (diff)
downloadFreeFileSync-669df123648aaa6aeccc70206b5417bc48b4e9ae.tar.gz
FreeFileSync-669df123648aaa6aeccc70206b5417bc48b4e9ae.tar.bz2
FreeFileSync-669df123648aaa6aeccc70206b5417bc48b4e9ae.zip
5.19
Diffstat (limited to 'zen/zstring.cpp')
-rw-r--r--zen/zstring.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/zen/zstring.cpp b/zen/zstring.cpp
index a469ade2..1cc037e8 100644
--- a/zen/zstring.cpp
+++ b/zen/zstring.cpp
@@ -33,19 +33,15 @@ public:
void insert(const void* ptr, size_t size)
{
boost::lock_guard<boost::mutex> dummy(lockActStrings);
- if (activeStrings.find(ptr) != activeStrings.end())
+ if (!activeStrings.insert(std::make_pair(ptr, size)).second)
reportProblem("Fatal Error: New memory points into occupied space: " + rawMemToString(ptr, size));
-
- activeStrings[ptr] = size;
}
void remove(const void* ptr)
{
boost::lock_guard<boost::mutex> dummy(lockActStrings);
- if (activeStrings.find(ptr) == activeStrings.end())
+ if (activeStrings.erase(ptr) != 1)
reportProblem("Fatal Error: No memory available for deallocation at this location!");
-
- activeStrings.erase(ptr);
}
static LeakChecker& instance() { static LeakChecker inst; return inst; }
bgstack15