Fix memory leak when restarting the Vulkan renderer

models_known needs to be freed after freeing its contents.
This commit is contained in:
Ricardo Garcia 2021-03-21 00:20:12 +01:00
parent e362e0280e
commit 17c2c94f07
3 changed files with 14 additions and 1 deletions

View file

@ -248,3 +248,4 @@ int Hunk_End (void);
void Hunk_Free (void *base);
void Mod_FreeAll (void);
void Mod_FreeModelsKnown (void);

View file

@ -1654,6 +1654,7 @@ void QVk_WaitAndShutdownAll (void)
}
Mod_FreeAll();
Mod_FreeModelsKnown();
Vk_ShutdownImages();
QVk_Shutdown();
}

View file

@ -101,7 +101,7 @@ void Mod_Reallocate (void)
models_known_max *= 2;
// free up
Mod_FreeAll();
free(models_known);
Mod_FreeModelsKnown();
}
if (models_known_max < (mod_max * 4))
@ -177,6 +177,17 @@ void Mod_FreeAll (void)
}
}
/*
================
Mod_FreeModelsKnown
================
*/
void Mod_FreeModelsKnown (void)
{
free(models_known);
models_known = NULL;
}
/*
===============================================================================