Skip to content

Commit 5cd6fc3

Browse files
author
G_Moris
committed
Fast fix by TracerDS
1 parent d59efc1 commit 5cd6fc3

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Client/core/CCommands.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ bool CCommands::Execute(const char* szCommand, const char* szParametersIn, bool
8787
char* szParameters = nullptr;
8888
if (szParametersIn)
8989
{
90-
szParameters = static_cast<char*>(alloca(strlen(szParametersIn) + 1));
90+
szParameters = new char[strlen(szParametersIn) + 1];
9191
std::strcpy(szParameters, szParametersIn);
9292
}
9393

@@ -177,6 +177,10 @@ bool CCommands::Execute(const char* szCommand, const char* szParametersIn, bool
177177
ss << key << " = " << val;
178178
val = ss.str();
179179
CCore::GetSingleton().GetConsole()->Print(val.c_str());
180+
181+
if (szParameters)
182+
delete[] szParameters;
183+
180184
return true;
181185
}
182186
}
@@ -205,7 +209,12 @@ bool CCommands::Execute(const char* szCommand, const char* szParametersIn, bool
205209
{
206210
bool bAllowScriptedBind = (!pEntry || pEntry->bAllowScriptedBind);
207211
if (m_pfnExecuteHandler(szCommand, szParameters, bHandleRemotely, (pEntry != NULL), bIsScriptedBind, bAllowScriptedBind))
212+
{
213+
if (szParameters)
214+
delete[] szParameters;
215+
208216
return true;
217+
}
209218
}
210219

211220
// Unknown command

0 commit comments

Comments
 (0)