mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-24 21:11:39 +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
d654e02dea
commit
cea97e5cc6
1 changed files with 10 additions and 10 deletions
|
@ -2487,10 +2487,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;
|
||||
|
||||
|
@ -2557,9 +2557,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)
|
||||
{
|
||||
|
@ -2569,20 +2569,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);
|
||||
|
@ -2591,11 +2591,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