From c495606f7554055a929c9c5061d47eb731561248 Mon Sep 17 00:00:00 2001 From: Peter Feerick Date: Mon, 4 Apr 2022 09:11:10 +1000 Subject: [PATCH] fix: Close f_open handle if background image found --- radio/src/gui/colorlcd/theme_manager.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/radio/src/gui/colorlcd/theme_manager.cpp b/radio/src/gui/colorlcd/theme_manager.cpp index d7ce4153b..1f4231716 100644 --- a/radio/src/gui/colorlcd/theme_manager.cpp +++ b/radio/src/gui/colorlcd/theme_manager.cpp @@ -305,6 +305,7 @@ void ThemeFile::applyBackground() FRESULT result = f_open(&file, rootDir.c_str(), FA_OPEN_EXISTING); if (result == FR_OK) { instance->setBackgroundImageFileName((char *)rootDir.c_str()); + f_close(&file); } else { // TODO: This needs to be made user configurable, not // require the file be deleted to remove global background @@ -315,6 +316,7 @@ void ThemeFile::applyBackground() result = f_open(&file, fileName, FA_OPEN_EXISTING); if (result == FR_OK) { instance->setBackgroundImageFileName(fileName); + f_close(&file); } else { instance->setBackgroundImageFileName(""); }