fixed misusage, freeing convar info while it can still be read
authorDavid Anderson <dvander@alliedmods.net>
Mon Oct 15 19:37:14 2007 +0000 (2007-10-15)
changeset 1578378b2e4b1f19
parent 1577 379db034d14d
child 1579 8951b7134937
fixed misusage, freeing convar info while it can still be read
fixed a minor memory leak
core/ConVarManager.cpp
     1.1 --- a/core/ConVarManager.cpp	Mon Oct 15 19:18:08 2007 +0000
     1.2 +++ b/core/ConVarManager.cpp	Mon Oct 15 19:37:14 2007 +0000
     1.3 @@ -228,13 +228,14 @@
     1.4  	/* If convar was created by SourceMod plugin... */
     1.5  	if (info->sourceMod)
     1.6  	{
     1.7 +		/* Then unlink it from SourceMM */
     1.8 +		g_SMAPI->UnregisterConCommandBase(g_PLAPI, pConVar);
     1.9 +
    1.10  		/* Delete string allocations */
    1.11  		delete [] pConVar->GetName(); 
    1.12  		delete [] pConVar->GetDefault();
    1.13  		delete [] pConVar->GetHelpText();
    1.14 -
    1.15 -		/* Then unlink it from SourceMM */
    1.16 -		g_SMAPI->UnregisterConCommandBase(g_PLAPI, pConVar);
    1.17 +		delete pConVar;
    1.18  	}
    1.19  }
    1.20