From 6c9133aaab2a9eb6cdfae0b3e47b0f6749213087 Mon Sep 17 00:00:00 2001 From: Larry Bernstone Date: Thu, 26 Sep 2019 08:09:39 -0600 Subject: [PATCH] Better cleanup on mount failures, as the idf api now seems to assign handle and mountpoint before failing. Fixes #3265 --- libraries/FFat/src/FFat.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libraries/FFat/src/FFat.cpp b/libraries/FFat/src/FFat.cpp index b61a8e3f61d..0d2b2cb26ab 100644 --- a/libraries/FFat/src/FFat.cpp +++ b/libraries/FFat/src/FFat.cpp @@ -58,6 +58,8 @@ bool F_Fat::begin(bool formatOnFail, const char * basePath, uint8_t maxOpenFiles esp_err_t err = esp_vfs_fat_spiflash_mount(basePath, partitionLabel, &conf, &_wl_handle); if(err){ log_e("Mounting FFat partition failed! Error: %d", err); + esp_vfs_fat_spiflash_unmount(basePath, _wl_handle); + _wl_handle = WL_INVALID_HANDLE; return false; } _impl->mountpoint(basePath);