1.1 --- a/core/CConVarManager.cpp Sat Feb 17 04:37:47 2007 +0000
1.2 +++ b/core/CConVarManager.cpp Sat Feb 17 05:33:31 2007 +0000
1.3 @@ -97,7 +97,7 @@
1.4 void CConVarManager::OnHandleDestroy(HandleType_t type, void *object)
1.5 {
1.6 ConVarInfo *info;
1.7 - ConCommandBase *cvar = static_cast<ConCommandBase *>(object);
1.8 + ConVar *cvar = static_cast<ConVar *>(object);
1.9
1.10 // Find convar in lookup trie
1.11 sm_trie_retrieve(m_ConVarCache, cvar->GetName(), reinterpret_cast<void **>(&info));
1.12 @@ -105,6 +105,11 @@
1.13 // If convar was created by SourceMod plugin...
1.14 if (info->sourceMod)
1.15 {
1.16 + // Delete string allocations
1.17 + delete [] cvar->GetName();
1.18 + delete [] cvar->GetDefault();
1.19 + delete [] cvar->GetHelpText();
1.20 +
1.21 // Then unregister it
1.22 g_SMAPI->UnregisterConCmdBase(g_PLAPI, cvar);
1.23 }
1.24 @@ -205,7 +210,7 @@
1.25 }
1.26
1.27 // Since we didn't find an existing convar (or concmd with the same name), now we can finally create it!
1.28 - cvar = new ConVar(name, defaultVal, flags, helpText, hasMin, min, hasMax, max);
1.29 + cvar = new ConVar(sm_strdup(name), sm_strdup(defaultVal), flags, sm_strdup(helpText), hasMin, min, hasMax, max);
1.30
1.31 // Find plugin creating convar
1.32 IPlugin *pl = g_PluginSys.FindPluginByContext(pContext->GetContext());