Merge pull request #827 from attermann/lfs_leak
Fix memory leak on failure to open
This commit is contained in:
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;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user