From d99c571f947ac69890fc60c4525122d1394c7338 Mon Sep 17 00:00:00 2001 From: Arisotura Date: Fri, 12 Apr 2024 19:43:02 +0200 Subject: [PATCH] FATStorage: make sure to always properly unmount the volume (fixes evil bug) --- src/FATStorage.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/FATStorage.cpp b/src/FATStorage.cpp index 0f1bf235..f735d4b8 100644 --- a/src/FATStorage.cpp +++ b/src/FATStorage.cpp @@ -110,6 +110,7 @@ bool FATStorage::InjectFile(const std::string& path, u8* data, u32 len) res = f_mount(&fs, "0:", 1); if (res != FR_OK) { + f_unmount("0:"); ff_disk_close(); return false; } @@ -146,6 +147,7 @@ u32 FATStorage::ReadFile(const std::string& path, u32 start, u32 len, u8* data) res = f_mount(&fs, "0:", 1); if (res != FR_OK) { + f_unmount("0:"); ff_disk_close(); return false; } @@ -1144,6 +1146,7 @@ bool FATStorage::Save() res = f_mount(&fs, "0:", 1); if (res != FR_OK) { + f_unmount("0:"); ff_disk_close(); return false; }