summaryrefslogtreecommitdiffstats
path: root/src/LeakFinder.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-01-23 17:54:38 +0100
committermadmaxoft <github@xoft.cz>2014-01-23 17:54:38 +0100
commit9774da81221fbadf45a3f856e1ae09e592d7ec33 (patch)
treecccc4aa37bbba1401953b93b99225568e2dcb76a /src/LeakFinder.cpp
parentRemoved CryptoPP files. (diff)
downloadcuberite-9774da81221fbadf45a3f856e1ae09e592d7ec33.tar
cuberite-9774da81221fbadf45a3f856e1ae09e592d7ec33.tar.gz
cuberite-9774da81221fbadf45a3f856e1ae09e592d7ec33.tar.bz2
cuberite-9774da81221fbadf45a3f856e1ae09e592d7ec33.tar.lz
cuberite-9774da81221fbadf45a3f856e1ae09e592d7ec33.tar.xz
cuberite-9774da81221fbadf45a3f856e1ae09e592d7ec33.tar.zst
cuberite-9774da81221fbadf45a3f856e1ae09e592d7ec33.zip
Diffstat (limited to '')
-rw-r--r--src/LeakFinder.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/LeakFinder.cpp b/src/LeakFinder.cpp
index 9d7f185ba..42a5afe56 100644
--- a/src/LeakFinder.cpp
+++ b/src/LeakFinder.cpp
@@ -862,8 +862,10 @@ static int MyAllocHook(int nAllocType, void *pvData,
{
// RequestID was found
size_t temp = g_CurrentMemUsage;
- g_CurrentMemUsage -= nSize ;
- g_pCRTTable->Remove(lRequest);
+ if (g_pCRTTable->Remove(lRequest))
+ {
+ g_CurrentMemUsage -= nSize;
+ }
if (g_CurrentMemUsage > temp)
{
printf("********************************************\n");
@@ -896,8 +898,11 @@ static int MyAllocHook(int nAllocType, void *pvData,
// Try to find the RequestID in the Hash-Table, mark it that it was freed
lReallocRequest = pHead->lRequest;
size_t temp = g_CurrentMemUsage;
- g_CurrentMemUsage -= pHead->nDataSize;
bRet = g_pCRTTable->Remove(lReallocRequest);
+ if (bRet)
+ {
+ g_CurrentMemUsage -= pHead->nDataSize;
+ }
if (g_CurrentMemUsage > temp)
{
printf("********************************************\n");