From 04743abe91d9a9cc7d7582d019151150baccd207 Mon Sep 17 00:00:00 2001 From: Misa Date: Fri, 3 Mar 2023 15:34:13 -0800 Subject: [PATCH] Destroy towerbg and titlebg textures in `destroy_buffers` For consistency, since they are created in create_buffers as well. I checked with Valgrind (which is very noisy on Wayland, it turns out), but I didn't see anything about them not being freed. It doesn't hurt to use VVV_freefunc here anyway, though, since it does a NULL check and nulls the pointer afterwards, which should prevent double-freeing and use-after-frees. --- desktop_version/src/Graphics.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/desktop_version/src/Graphics.cpp b/desktop_version/src/Graphics.cpp index 1e56e603..88c08576 100644 --- a/desktop_version/src/Graphics.cpp +++ b/desktop_version/src/Graphics.cpp @@ -208,6 +208,8 @@ void Graphics::destroy_buffers(void) VVV_freefunc(SDL_DestroyTexture, menuoffTexture); VVV_freefunc(SDL_DestroyTexture, foregroundTexture); VVV_freefunc(SDL_DestroyTexture, backgroundTexture); + VVV_freefunc(SDL_DestroyTexture, towerbg.texture); + VVV_freefunc(SDL_DestroyTexture, titlebg.texture); } void Graphics::drawspritesetcol(int x, int y, int t, int c)