mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-01-31 04:20:34 +00:00
- fixed memory leaks in network code.
ReadString allocates a buffer, so saving it in a local variable and then forgetting it will not free the buffer afterward. (This should probably be refactored to use some safer methods to read the string than this old-school method...)
This commit is contained in:
parent
b706e8fead
commit
1669e10f6e
1 changed files with 10 additions and 10 deletions
|
@ -2497,10 +2497,10 @@ void Net_DoCommand (int type, uint8_t **stream, int player)
|
|||
|
||||
case DEM_RUNNAMEDSCRIPT:
|
||||
{
|
||||
char *sname = ReadString(stream);
|
||||
s = ReadString(stream);
|
||||
int argn = ReadByte(stream);
|
||||
|
||||
RunScript(stream, players[player].mo, -FName(sname), argn & 127, (argn & 128) ? ACS_ALWAYS : 0);
|
||||
RunScript(stream, players[player].mo, -FName(s), argn & 127, (argn & 128) ? ACS_ALWAYS : 0);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -2567,9 +2567,9 @@ void Net_DoCommand (int type, uint8_t **stream, int player)
|
|||
|
||||
case DEM_KILLCLASSCHEAT:
|
||||
{
|
||||
char *classname = ReadString (stream);
|
||||
s = ReadString (stream);
|
||||
int killcount = 0;
|
||||
PClassActor *cls = PClass::FindActor(classname);
|
||||
PClassActor *cls = PClass::FindActor(s);
|
||||
|
||||
if (cls != NULL)
|
||||
{
|
||||
|
@ -2579,20 +2579,20 @@ void Net_DoCommand (int type, uint8_t **stream, int player)
|
|||
{
|
||||
killcount += KillAll(cls_rep);
|
||||
}
|
||||
Printf ("Killed %d monsters of type %s.\n",killcount, classname);
|
||||
Printf ("Killed %d monsters of type %s.\n",killcount, s);
|
||||
}
|
||||
else
|
||||
{
|
||||
Printf ("%s is not an actor class.\n", classname);
|
||||
Printf ("%s is not an actor class.\n", s);
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
case DEM_REMOVE:
|
||||
{
|
||||
char *classname = ReadString(stream);
|
||||
s = ReadString(stream);
|
||||
int removecount = 0;
|
||||
PClassActor *cls = PClass::FindActor(classname);
|
||||
PClassActor *cls = PClass::FindActor(s);
|
||||
if (cls != NULL && cls->IsDescendantOf(RUNTIME_CLASS(AActor)))
|
||||
{
|
||||
removecount = RemoveClass(cls);
|
||||
|
@ -2601,11 +2601,11 @@ void Net_DoCommand (int type, uint8_t **stream, int player)
|
|||
{
|
||||
removecount += RemoveClass(cls_rep);
|
||||
}
|
||||
Printf("Removed %d actors of type %s.\n", removecount, classname);
|
||||
Printf("Removed %d actors of type %s.\n", removecount, s);
|
||||
}
|
||||
else
|
||||
{
|
||||
Printf("%s is not an actor class.\n", classname);
|
||||
Printf("%s is not an actor class.\n", s);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue