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 committed by toaster
parent eeb208312a
commit 2ba1417b9e

View file

@ -1393,6 +1393,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;