From b64a4f6c84fd5996574e191d5aafa1a522573efe Mon Sep 17 00:00:00 2001 From: s1lentq Date: Sat, 14 Nov 2015 18:25:02 +0600 Subject: [PATCH] Fix: bug with removeHook not erases address callback --- rehlds/rehlds/hookchains_impl.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rehlds/rehlds/hookchains_impl.cpp b/rehlds/rehlds/hookchains_impl.cpp index 1828617..5a21ec3 100644 --- a/rehlds/rehlds/hookchains_impl.cpp +++ b/rehlds/rehlds/hookchains_impl.cpp @@ -38,8 +38,13 @@ void AbstractHookChainRegistry::removeHook(void* hookFunc) { // erase hook for (int i = 0; i < m_NumHooks; i++) { if (hookFunc == m_Hooks[i]) { - if(--m_NumHooks != i) + if (--m_NumHooks != i) + { Q_memmove(&m_Hooks[i], &m_Hooks[i + 1], (m_NumHooks - i) * sizeof(m_Hooks[0])); + m_Hooks[m_NumHooks] = NULL; + } + else + m_Hooks[i] = NULL; return; }