From e294799c011a7a90a5680d61f72bdd510ecc7a9a Mon Sep 17 00:00:00 2001 From: Aciz Date: Tue, 28 Nov 2023 18:25:15 +0200 Subject: [PATCH] Fix memory leak on vulkan renderer If r_cache was set to 1, and RE_Shutdown was called with REF_KEEP_CONTEXT (such as when loading a new map), vk_release_resources would never get called, causing memory leak --- src/renderervk/tr_init.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/renderervk/tr_init.c b/src/renderervk/tr_init.c index f34045eb..806cbde6 100644 --- a/src/renderervk/tr_init.c +++ b/src/renderervk/tr_init.c @@ -2244,12 +2244,12 @@ static void RE_Shutdown( refShutdownCode_t code ) { if ( r_cache->integer ) { if ( tr.registered ) { +#ifdef USE_VULKAN + vk_release_resources(); +#endif if ( code != REF_KEEP_CONTEXT ) { //R_IssuePendingRenderCommands(); R_DeleteTextures(); -#ifdef USE_VULKAN - vk_release_resources(); -#endif } else { // backup the current media