From a92372887766aeb5fe0908d5ae6a221f1c19af30 Mon Sep 17 00:00:00 2001 From: erorcun Date: Sun, 27 Jun 2021 00:34:46 +0300 Subject: Fix map texture leak --- src/core/Frontend.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index ec4e33ef..84a1e771 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -3653,7 +3653,9 @@ CMenuManager::LoadAllTextures() #ifdef MENU_MAP static bool menuOptionAdded = false; for (int i = 0; i < ARRAY_SIZE(MapFilenames); i++) { - if (!menuOptionAdded && RwTextureRead(MapFilenames[i][0], MapFilenames[i][1])) { + RwTexture *firstTile; + if (!menuOptionAdded && (firstTile = RwTextureRead(MapFilenames[i][0], MapFilenames[i][1]))) { + RwTextureDestroy(firstTile); FrontendOptionSetCursor(MENUPAGE_PAUSE_MENU, 2, false); FrontendOptionAddBuiltinAction("FEG_MAP", MENUACTION_CHANGEMENU, MENUPAGE_MAP, SAVESLOT_NONE); menuOptionAdded = true; -- cgit v1.2.3