- fixed some memory leaks: The global symbol table and the argument list for DECORATE called action specials were never freed.

This commit is contained in:
Christoph Oelckers 2015-04-28 15:34:48 +02:00
parent 137e624b55
commit 2d0f6339f7
7 changed files with 24 additions and 2 deletions

View file

@ -2261,6 +2261,8 @@ void D_DoomMain (void)
do
{
InitGlobalSymbols();
if (restart)
{
C_InitConsole(SCREENWIDTH, SCREENHEIGHT, false);

View file

@ -517,8 +517,18 @@ void PType::StaticInit()
TypeTable.AddType(TypeState = new PStatePointer);
TypeTable.AddType(TypeFixed = new PFixed);
TypeTable.AddType(TypeAngle = new PAngle);
}
void ReleaseGlobalSymbols()
{
GlobalSymbols.ReleaseSymbols();
}
void InitGlobalSymbols()
{
// Add types to the global symbol table.
atterm(ReleaseGlobalSymbols);
GlobalSymbols.ReleaseSymbols();
GlobalSymbols.AddSymbol(new PSymbolType(NAME_sByte, TypeSInt8));
GlobalSymbols.AddSymbol(new PSymbolType(NAME_Byte, TypeUInt8));
GlobalSymbols.AddSymbol(new PSymbolType(NAME_Short, TypeSInt16));

View file

@ -801,4 +801,6 @@ public:
PSymbolConstString() {}
};
void InitGlobalSymbols();
#endif

View file

@ -72,11 +72,11 @@ FxVMFunctionCall *DoActionSpecials(FScanner &sc, FState & state, Baggage &bag)
int min_args, max_args;
FString specname = sc.String;
FArgumentList *args = new FArgumentList;
int special = P_FindLineSpecial(sc.String, &min_args, &max_args);
if (special > 0 && min_args >= 0)
{
FArgumentList *args = new FArgumentList;
args->Push(new FxParameter(new FxConstant(special, sc)));
i = 0;

View file

@ -1279,7 +1279,7 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE nothing, LPSTR cmdline, int n
_CrtSetDbgFlag (_CrtSetDbgFlag(0) | _CRTDBG_LEAK_CHECK_DF);
// Use this to break at a specific allocation number.
//_crtBreakAlloc = 18800;
_crtBreakAlloc = 22884;
#endif
DoMain (hInstance);

View file

@ -1293,6 +1293,10 @@ void I_StartupRawPS2()
{
JoyDevices[INPUT_RawPS2] = joys;
}
else
{
delete joys;
}
}
}
}

View file

@ -783,6 +783,10 @@ void I_StartupXInput()
{
JoyDevices[INPUT_XInput] = joys;
}
else
{
delete joys;
}
}
}
}