Merge pull request #827 from attermann/lfs_leak

Fix memory leak on failure to open
This commit is contained in:
Ha Thach authored and GitHub committed 2024-07-18 17:17:25 +07:00
commit 11b6799f25
1 file changed
+6
@@ -66,6 +66,9 @@ bool File::_open_file (char const *filepath, uint8_t mode)
{
// failed to open
PRINT_LFS_ERR(rc);
// free memory
rtos_free(_file);
_file = NULL;
return false;
}
@@ -89,6 +92,9 @@ bool File::_open_dir (char const *filepath)
{
// failed to open
PRINT_LFS_ERR(rc);
// free memory
rtos_free(_dir);
_dir = NULL;
return false;
}