From c31de8b6730ad1d72ef7c65fadeb35e48cf5aa4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20M=C3=BAdry?= Date: Thu, 11 Jun 2026 12:50:50 +0200 Subject: [PATCH] fix(fatfs): Fix esp_vfs_fat_unregister_path leak if esp_vfs_unregister fails --- components/fatfs/vfs/vfs_fat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/fatfs/vfs/vfs_fat.c b/components/fatfs/vfs/vfs_fat.c index 11c844c10a1..ed31f1e872b 100644 --- a/components/fatfs/vfs/vfs_fat.c +++ b/components/fatfs/vfs/vfs_fat.c @@ -242,7 +242,7 @@ esp_err_t esp_vfs_fat_unregister_path(const char* base_path) vfs_fat_ctx_t* fat_ctx = s_fat_ctxs[ctx]; esp_err_t err = esp_vfs_unregister(fat_ctx->base_path); if (err != ESP_OK) { - return err; + ESP_LOGW(TAG, "esp_vfs_unregister failed (0x%x), cleaning up anyway", err); // should not happen, but if it does, we don't want to leak memory and keep the VFS in a broken state } _lock_close(&fat_ctx->lock); @@ -256,7 +256,7 @@ esp_err_t esp_vfs_fat_unregister_path(const char* base_path) free(fat_ctx->flags); free(fat_ctx); s_fat_ctxs[ctx] = NULL; - return ESP_OK; + return err; } esp_err_t esp_vfs_fat_info(const char* base_path,