fix:[dfsv1][elm]Fixed a memory leak in dfs_elm_close
RT-Thread BSP Static Build Check / 🔍 Summary of Git Diff Changes (push) Has been cancelled
RT-Thread BSP Static Build Check / ${{ matrix.legs.RTT_BSP }} (push) Has been cancelled
RT-Thread BSP Static Build Check / collect-artifacts (push) Has been cancelled
pkgs_test / change (push) Has been cancelled
utest_auto_run / A9 :components/dfs.cfg (push) Has been cancelled
utest_auto_run / A9 :components/lwip.cfg (push) Has been cancelled
utest_auto_run / A9 :components/netdev.cfg (push) Has been cancelled
utest_auto_run / A9 :components/sal.cfg (push) Has been cancelled
utest_auto_run / A9 :cpp11/cpp11.cfg (push) Has been cancelled
utest_auto_run / AARCH64-rtsmart :default.cfg (push) Has been cancelled
utest_auto_run / A9-rtsmart :default.cfg (push) Has been cancelled
utest_auto_run / RISCV-rtsmart :default.cfg (push) Has been cancelled
utest_auto_run / XUANTIE-rtsmart :default.cfg (push) Has been cancelled
utest_auto_run / AARCH64 :default.cfg (push) Has been cancelled
utest_auto_run / AARCH64-smp :default.cfg (push) Has been cancelled
utest_auto_run / A9 :default.cfg (push) Has been cancelled
utest_auto_run / A9-smp :default.cfg (push) Has been cancelled
utest_auto_run / RISCV :default.cfg (push) Has been cancelled
utest_auto_run / RISCV-smp :default.cfg (push) Has been cancelled
utest_auto_run / A9 :kernel/atomic_c11.cfg (push) Has been cancelled
utest_auto_run / RISCV :kernel/atomic_c11.cfg (push) Has been cancelled
utest_auto_run / A9 :kernel/ipc.cfg (push) Has been cancelled
utest_auto_run / A9 :kernel/kernel_basic.cfg (push) Has been cancelled
utest_auto_run / A9 :kernel/mem.cfg (push) Has been cancelled
ToolsCI / Tools (push) Has been cancelled

This commit is contained in:
wdfk-prog
2025-10-29 13:10:41 +08:00
committed by Rbb666
parent 76c0f2d08d
commit bd53bbaa76
2 changed files with 23 additions and 5 deletions
+21 -1
View File
@@ -152,9 +152,29 @@ endif
depends on RT_DFS_ELM_REENTRANT
config RT_DFS_ELM_USE_EXFAT
bool "Enable RT_DFS_ELM_USE_EXFAT"
bool "Enable exFAT filesystem support"
default n
depends on RT_DFS_ELM_USE_LFN >= 1
help
exFAT (Extended File Allocation Table) is a file system
designed for large-capacity storage devices.
Key features and recommendations:
- Target scenarios: Primarily used for storage media requiring
support for very large files (>4GB) or large partitions
(>32GB), such as high-capacity SD cards or USB drives.
- Resource cost: Enabling exFAT support will significantly
increase the code size (ROM footprint) of the file system.
- Recommendation:
For small-capacity storage devices (e.g., SPI Flash or
eMMC under 32GB), the standard FAT16 or FAT32 file
systems are perfectly adequate. It is strongly recommended
to keep this option disabled unless you absolutely need to
handle large-capacity storage, in order to conserve
valuable code space.
endmenu
endif
@@ -15,6 +15,7 @@
* 2017-02-13 Hichard Update Fatfs version to 0.12b, support exFAT.
* 2017-04-11 Bernard fix the st_blksize issue.
* 2017-05-26 Urey fix f_mount error when mount more fats
* 2025-10-29 wdfk-prog Fixed a memory leak in dfs_elm_close
*/
#include <rtthread.h>
@@ -468,10 +469,7 @@ int dfs_elm_close(struct dfs_file *file)
FRESULT result;
RT_ASSERT(file->vnode->ref_count > 0);
if (file->vnode->ref_count > 1)
{
return 0;
}
RT_ASSERT(file->data != RT_NULL);
result = FR_OK;
if (file->vnode->type == FT_DIRECTORY)
{