mirror of
https://github.com/alliedmodders/metamod-source.git
synced 2025-02-20 13:54:14 +01:00
Fixed various memory leaks
--HG-- extra : convert_revision : svn%3Ac2935e3e-5518-0410-8daf-afa5dab7d4e3/trunk%40152
This commit is contained in:
parent
6875cd1f74
commit
386eef09d3
@ -251,6 +251,7 @@ namespace SourceHook
|
||||
// Remove this element and move to the next one
|
||||
iterator tmp = *this;
|
||||
++tmp;
|
||||
delete (*iter);
|
||||
hash->m_Buckets[curbucket]->erase(iter);
|
||||
*this = tmp;
|
||||
|
||||
|
@ -751,6 +751,12 @@ namespace SourceHook
|
||||
delete m_FreeIters;
|
||||
m_FreeIters = iter;
|
||||
}
|
||||
while (m_UsedIters)
|
||||
{
|
||||
CIter *iter = m_UsedIters->m_pNext;
|
||||
delete m_UsedIters;
|
||||
m_UsedIters = iter;
|
||||
}
|
||||
}
|
||||
IHookList::IIter *CSourceHookImpl::CHookList::GetIter()
|
||||
{
|
||||
|
@ -1,6 +1,7 @@
|
||||
// Hello BAIL!
|
||||
// hello pm how are you
|
||||
// I'm fine, what about you?
|
||||
// not bad, just looking for mem leaks
|
||||
// This is a test file
|
||||
|
||||
#include <stdio.h>
|
||||
@ -11,6 +12,7 @@
|
||||
#include "sh_tinyhash.h"
|
||||
#include "sh_list.h"
|
||||
#include "sourcehook_impl.h"
|
||||
#include "sourcehook.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -675,6 +675,9 @@ bool TestBasic(std::string &error)
|
||||
SH_REMOVE_HOOK_MEMFUNC(Test, F8, pTest, &f1_handlers, &HandlersF1::Pre, false);
|
||||
SH_REMOVE_HOOK_MEMFUNC(Test, F9, pTest, &f1_handlers, &HandlersF1::Pre, false);
|
||||
SH_REMOVE_HOOK_MEMFUNC(Test, F10, pTest, &f1_handlers, &HandlersF1::Pre, false);
|
||||
|
||||
g_SHImpl.CompleteShutdown();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -579,6 +579,23 @@ bool TestReentr(std::string &error)
|
||||
new State_C1_F(g_pC1),
|
||||
NULL), "7");
|
||||
|
||||
SH_REMOVE_HOOK_STATICFUNC(C1, F, g_pC1, Handler_C1_F, false);
|
||||
SH_REMOVE_HOOK_STATICFUNC(C1, G, g_pC1, Handler_C1_G, false);
|
||||
SH_REMOVE_HOOK_STATICFUNC(C2, F, g_pC2, Handler_C2_F, false);
|
||||
SH_REMOVE_HOOK_STATICFUNC(C2, G, g_pC2, Handler_C2_G, false);
|
||||
SH_REMOVE_HOOK_STATICFUNC(C3, F, g_pC3, Handler_C3_F, false);
|
||||
SH_REMOVE_HOOK_STATICFUNC(C3, G, g_pC3, Handler_C3_G, false);
|
||||
SH_REMOVE_HOOK_STATICFUNC(C4, F, g_pC4, Handler_C4_F, false);
|
||||
SH_REMOVE_HOOK_STATICFUNC(C4, G, g_pC4, Handler_C4_G, false);
|
||||
SH_REMOVE_HOOK_STATICFUNC(C5, F, g_pC5, Handler_C5_F, false);
|
||||
SH_REMOVE_HOOK_STATICFUNC(C5, G, g_pC5, Handler_C5_G, false);
|
||||
SH_REMOVE_HOOK_STATICFUNC(C6, F, g_pC6, Handler_C6_F, false);
|
||||
SH_REMOVE_HOOK_STATICFUNC(C6, G, g_pC6, Handler_C6_G, false);
|
||||
SH_REMOVE_HOOK_STATICFUNC(C7, F, g_pC7, Handler_C7_F, false);
|
||||
SH_REMOVE_HOOK_STATICFUNC(C7, G, g_pC7, Handler_C7_G, false);
|
||||
SH_REMOVE_HOOK_STATICFUNC(C8, F, g_pC8, Handler_C8_F, false);
|
||||
SH_REMOVE_HOOK_STATICFUNC(C8, G, g_pC8, Handler_C8_G, false);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user