summaryrefslogtreecommitdiffstats
path: root/src/LeakFinder.cpp
diff options
context:
space:
mode:
authordaniel0916 <theschokolps@gmail.com>2014-04-07 20:12:17 +0200
committerdaniel0916 <theschokolps@gmail.com>2014-04-07 20:12:17 +0200
commit2e9754ac1cf0537c12ab7974cf55c451c0724540 (patch)
tree713c5b8c8f22f77893b30b9c8cefca4a7c491483 /src/LeakFinder.cpp
parentFixed merge conflict (diff)
parentFixed some more minor issues with the redstone simulator. (diff)
downloadcuberite-2e9754ac1cf0537c12ab7974cf55c451c0724540.tar
cuberite-2e9754ac1cf0537c12ab7974cf55c451c0724540.tar.gz
cuberite-2e9754ac1cf0537c12ab7974cf55c451c0724540.tar.bz2
cuberite-2e9754ac1cf0537c12ab7974cf55c451c0724540.tar.lz
cuberite-2e9754ac1cf0537c12ab7974cf55c451c0724540.tar.xz
cuberite-2e9754ac1cf0537c12ab7974cf55c451c0724540.tar.zst
cuberite-2e9754ac1cf0537c12ab7974cf55c451c0724540.zip
Diffstat (limited to 'src/LeakFinder.cpp')
-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");