- Fixed: The MBFParamStates array leaked memory.

SVN r1839 (trunk)
This commit is contained in:
Randy Heit 2009-09-15 22:44:07 +00:00
parent 45842e28bd
commit f1dc490151

View file

@ -149,7 +149,7 @@ static TArray<const PClass *> WeaponNames;
// List of states that are hacked to use a codepointer // List of states that are hacked to use a codepointer
struct MBFParamState struct MBFParamState
{ {
FState * state; FState *state;
int pointer; int pointer;
}; };
static TArray<MBFParamState *> MBFParamStates; static TArray<MBFParamState *> MBFParamStates;
@ -1610,7 +1610,7 @@ static void SetPointer(FState *state, PSymbol *sym, int frame = 0)
{ {
if (!symname.CompareNoCase(MBFCodePointers[i].name)) if (!symname.CompareNoCase(MBFCodePointers[i].name))
{ {
MBFParamState * newstate = new MBFParamState; MBFParamState *newstate = new MBFParamState;
newstate->state = state; newstate->state = state;
newstate->pointer = i; newstate->pointer = i;
MBFParamStates.Push(newstate); MBFParamStates.Push(newstate);
@ -2495,6 +2495,7 @@ static void UnloadDehSupp ()
for (unsigned int i=0; i < MBFParamStates.Size(); i++) for (unsigned int i=0; i < MBFParamStates.Size(); i++)
{ {
SetDehParams(MBFParamStates[i]->state, MBFParamStates[i]->pointer); SetDehParams(MBFParamStates[i]->state, MBFParamStates[i]->pointer);
delete MBFParamStates[i];
} }
MBFParamStates.Clear(); MBFParamStates.Clear();
MBFParamStates.ShrinkToFit(); MBFParamStates.ShrinkToFit();