Skip to content
Snippets Groups Projects
Commit 70939a7a authored by Monster Iestyn's avatar Monster Iestyn
Browse files

Set "allocated" flag to off if setting a string from PossibleValue afterwards,...

Set "allocated" flag to off if setting a string from PossibleValue afterwards, or if not setting a new value at all.
parent d71b99a5
No related branches found
No related tags found
1 merge request!1477Possible netgame quit crash hotfix
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment