Merge branch 'possible-netgame-quit-crash-hotfix' into 'next'

Possible netgame quit crash hotfix

Closes #487

See merge request STJr/SRB2!1477
This commit is contained in:
LJ Sonic 2021-04-25 16:33:49 -04:00
commit 1e394a80bf

View file

@ -1433,6 +1433,7 @@ static void Setvalue(consvar_t *var, const char *valstr, boolean stealth)
if (var->revert.allocated)
{
Z_Free(var->revert.v.string);
var->revert.allocated = false; // the below value is not allocated in zone memory, don't try to free it!
}
var->revert.v.const_munge = var->PossibleValue[i].strvalue;
@ -1505,6 +1506,7 @@ found:
if (var->revert.allocated)
{
Z_Free(var->revert.v.string);
var->revert.allocated = false; // the below value is not allocated in zone memory, don't try to free it!
}
var->revert.v.const_munge = var->PossibleValue[i].strvalue;
@ -1523,6 +1525,7 @@ found:
if (var->revert.allocated)
{
Z_Free(var->revert.v.string);
// Z_StrDup creates a new zone memory block, so we can keep the allocated flag on
}
var->revert.v.string = Z_StrDup(valstr);
@ -1787,6 +1790,7 @@ void CV_RevertNetVars(void)
if (cvar->revert.allocated)
{
Z_Free(cvar->revert.v.string);
cvar->revert.allocated = false; // no value being held now
}
cvar->revert.v.string = NULL;