Free zstring when switching to preset value

This is only applicable for bounded cvars (MIN, MAX),
since otherwise there's no way to allocate a zstring.
This commit is contained in:
James R 2021-04-25 21:55:04 -07:00
parent d18fc8882f
commit 85914cc7cd

View file

@ -1441,6 +1441,10 @@ static void Setvalue(consvar_t *var, const char *valstr, boolean stealth)
return;
}
// free the old value string
Z_Free(var->zstring);
var->zstring = NULL;
var->value = var->PossibleValue[i].value;
var->string = var->PossibleValue[i].strvalue;
goto finish;