diff --git a/src/common/cvar.c b/src/common/cvar.c index 2f59bf46..c972f4bc 100644 --- a/src/common/cvar.c +++ b/src/common/cvar.c @@ -585,3 +585,24 @@ Cvar_Init(void) Cmd_AddCommand("cvarlist", Cvar_List_f); } +/* + * Free list of cvars + */ +void +Cvar_Fini(void) +{ + cvar_t *var; + + for (var = cvar_vars; var;) + { + cvar_t *c = var; + Z_Free(var->string); + Z_Free(var->name); + Z_Free(var); + var = c->next; + } + + Cmd_RemoveCommand("cvarlist"); + Cmd_RemoveCommand("set"); +} + diff --git a/src/common/header/common.h b/src/common/header/common.h index 7e329180..42503051 100644 --- a/src/common/header/common.h +++ b/src/common/header/common.h @@ -475,6 +475,8 @@ void Cvar_WriteVariables(char *path); void Cvar_Init(void); +void Cvar_Fini(void); + char *Cvar_Userinfo(void); /* returns an info string containing all the CVAR_USERINFO cvars */ diff --git a/src/common/misc.c b/src/common/misc.c index 4cc2adb4..91b3a148 100644 --- a/src/common/misc.c +++ b/src/common/misc.c @@ -411,5 +411,6 @@ Qcommon_Frame(int msec) void Qcommon_Shutdown(void) { + Cvar_Fini(); }