From e4077a927980f134b1a590f32b6cb41f017de287 Mon Sep 17 00:00:00 2001 From: angryproton Date: Sun, 12 Jul 2026 15:40:37 +0800 Subject: [PATCH] =?UTF-8?q?[fix][dfs]=20=E4=BF=AE=E5=A4=8Delmfat=E6=8C=82?= =?UTF-8?q?=E8=BD=BD=E5=A4=B1=E8=B4=A5=E6=97=B6=E7=9A=84=E5=86=85=E5=AD=98?= =?UTF-8?q?=E6=B3=84=E6=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/dfs/dfs_v1/filesystems/elmfat/dfs_elm.c | 3 +++ components/dfs/dfs_v2/filesystems/elmfat/dfs_elm.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/components/dfs/dfs_v1/filesystems/elmfat/dfs_elm.c b/components/dfs/dfs_v1/filesystems/elmfat/dfs_elm.c index afb2a0d46d9..f6e699e197d 100644 --- a/components/dfs/dfs_v1/filesystems/elmfat/dfs_elm.c +++ b/components/dfs/dfs_v1/filesystems/elmfat/dfs_elm.c @@ -156,7 +156,10 @@ int dfs_elm_mount(struct dfs_filesystem *fs, unsigned long rwflag, const void *d /* open the root directory to test whether the fatfs is valid */ result = f_opendir(dir, drive); if (result != FR_OK) + { + rt_free(dir); goto __err; + } /* mount succeed! */ fs->data = fat; diff --git a/components/dfs/dfs_v2/filesystems/elmfat/dfs_elm.c b/components/dfs/dfs_v2/filesystems/elmfat/dfs_elm.c index cb1479f6ca9..38822568be5 100644 --- a/components/dfs/dfs_v2/filesystems/elmfat/dfs_elm.c +++ b/components/dfs/dfs_v2/filesystems/elmfat/dfs_elm.c @@ -192,7 +192,10 @@ static int dfs_elm_mount(struct dfs_mnt *mnt, unsigned long rwflag, const void * /* open the root directory to test whether the fatfs is valid */ result = f_opendir(dir, drive); if (result != FR_OK) + { + rt_free(dir); goto __err; + } /* mount succeed! */ mnt->data = fat;