From 2ba1417b9ebf3e7822a01867f8970c6f83626b92 Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 25 Apr 2021 21:55:04 -0700 Subject: [PATCH] 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. --- src/command.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/command.c b/src/command.c index 1a87573f2..752b27a84 100644 --- a/src/command.c +++ b/src/command.c @@ -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;