From 841c3a4de7075fb4858f7fe3e89e30249560b665 Mon Sep 17 00:00:00 2001 From: LiPeng Date: Thu, 10 Sep 2026 08:36:12 +0200 Subject: [PATCH] fix(fatfs): fix a memory leak bug when FF_USE_DYN_BUFFER was enabled BDL diskio test part only; the rest of the commit is already on release/v6.0 via 4f7b1af0f94, which predates components/fatfs/test_apps/bdl. (cherry picked from commit a8b5b8d582dd25405456dc770987aeb515238f8f) --- components/fatfs/test_apps/bdl/main/test_fatfs_bdl.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/components/fatfs/test_apps/bdl/main/test_fatfs_bdl.c b/components/fatfs/test_apps/bdl/main/test_fatfs_bdl.c index 2cc86df6a11..6752504821a 100644 --- a/components/fatfs/test_apps/bdl/main/test_fatfs_bdl.c +++ b/components/fatfs/test_apps/bdl/main/test_fatfs_bdl.c @@ -80,9 +80,15 @@ TEST_CASE("(BDL) diskio register, format, write and read on partition", "[fatfs] TEST_ASSERT_EQUAL(FR_OK, f_mkfs(drv, &opt, work_area, sizeof(work_area))); FATFS fs; +#if FF_USE_DYN_BUFFER + fs.win = NULL; +#endif TEST_ASSERT_EQUAL(FR_OK, f_mount(&fs, drv, 1)); FIL file; +#if !FF_FS_TINY && FF_USE_DYN_BUFFER + file.buf = NULL; +#endif UINT bw; TEST_ASSERT_EQUAL(FR_OK, f_open(&file, "test.txt", FA_OPEN_ALWAYS | FA_READ | FA_WRITE));