From 5e49d08ba5f304e362f2db1775e16dffa2225a92 Mon Sep 17 00:00:00 2001 From: staphen Date: Fri, 5 Nov 2021 03:33:19 -0400 Subject: [PATCH] Close SDL_RWops in LoadPNG() --- Source/utils/png.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Source/utils/png.h b/Source/utils/png.h index d5b69de3c..be0babe04 100644 --- a/Source/utils/png.h +++ b/Source/utils/png.h @@ -44,7 +44,9 @@ inline void QuitPNG() inline SDL_Surface *LoadPNG(const char *file) { SDL_RWops *rwops = SFileOpenRw(file); - return IMG_LoadPNG_RW(rwops); + SDL_Surface *surface = IMG_LoadPNG_RW(rwops); + SDL_RWclose(rwops); + return surface; } } // namespace devilution