diff --git a/src/command.c b/src/command.c
index f1bf7dfb52b3586763571b1276058f4dad19b0f1..951e3dd0918c7d8ac542248f011508ab8f96fcdc 100644
--- a/src/command.c
+++ b/src/command.c
@@ -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;
@@ -1503,14 +1507,7 @@ static void Setvalue(consvar_t *var, const char *valstr, boolean stealth)
 found:
 			if (client && execversion_enabled)
 			{
-				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;
-
 				return;
 			}