From 78f389bd8079a240933be0d44eefd482317eedbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 11 Oct 2026 21:37:20 +0200 Subject: [PATCH] Close the file used to detect a background image's format Co-Authored-By: Claude Opus 5.5 --- UI/GameSettingsScreen.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index e20b5ff7ff..f53fffa8a5 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -1632,6 +1632,9 @@ void GameSettingsScreen::OnChangeBackground(UI::EventParams &e) { if (f != nullptr && 8 == fread(buffer, 1, ARRAY_SIZE(buffer), f)) { type = DetectImageFileType(buffer, ARRAY_SIZE(buffer)); } + if (f) { + fclose(f); + } std::string filename; switch (type) {