From bd97bdd3787be8b4d6d3eb96d1f69bcf6fdb3241 Mon Sep 17 00:00:00 2001 From: Matt Woodrow Date: Mon, 11 May 2009 11:32:59 +1200 Subject: [PATCH] Fixed unhook event crash (bug 3814, r=dvander) --- core/EventManager.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/EventManager.cpp b/core/EventManager.cpp index 04888f3b..a95e78c9 100644 --- a/core/EventManager.cpp +++ b/core/EventManager.cpp @@ -194,7 +194,7 @@ EventHookError EventManager::HookEvent(const char *name, IPluginFunction *pFunct } /* Cache the name for post hooks */ - pHook->name = strdup(name); + pHook->name = sm_strdup(name); /* Increase reference count */ pHook->refCount++; @@ -300,7 +300,7 @@ EventHookError EventManager::UnhookEvent(const char *name, IPluginFunction *pFun sm_trie_delete(m_EventHooks, name); /* Free the cached name */ - free(pHook->name); + delete pHook->name; /* And finally free structure memory */ delete pHook; @@ -472,7 +472,7 @@ bool EventManager::OnFireEvent_Post(IGameEvent *pEvent, bool bDontBroadcast) assert(pHook->pPostHook == NULL); assert(pHook->pPreHook == NULL); sm_trie_delete(m_EventHooks, pHook->name); - free(pHook->name); + delete pHook->name; delete pHook; } }