- 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 do
{ {
InitGlobalSymbols();
if (restart) if (restart)
{ {
C_InitConsole(SCREENWIDTH, SCREENHEIGHT, false); C_InitConsole(SCREENWIDTH, SCREENHEIGHT, false);

View File

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

View File

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

View File

@ -72,11 +72,11 @@ FxVMFunctionCall *DoActionSpecials(FScanner &sc, FState & state, Baggage &bag)
int min_args, max_args; int min_args, max_args;
FString specname = sc.String; FString specname = sc.String;
FArgumentList *args = new FArgumentList;
int special = P_FindLineSpecial(sc.String, &min_args, &max_args); int special = P_FindLineSpecial(sc.String, &min_args, &max_args);
if (special > 0 && min_args >= 0) if (special > 0 && min_args >= 0)
{ {
FArgumentList *args = new FArgumentList;
args->Push(new FxParameter(new FxConstant(special, sc))); args->Push(new FxParameter(new FxConstant(special, sc)));
i = 0; 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); _CrtSetDbgFlag (_CrtSetDbgFlag(0) | _CRTDBG_LEAK_CHECK_DF);
// Use this to break at a specific allocation number. // Use this to break at a specific allocation number.
//_crtBreakAlloc = 18800; _crtBreakAlloc = 22884;
#endif #endif
DoMain (hInstance); DoMain (hInstance);

View File

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

View File

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