Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
littlefs: Fixed issue with cleanup in mount function on error #7851
As a part of the v1.6 update (#7713), littlefs added proper handling for cleaning up memory in the case of an error during mount (ARMmbed/littlefs#80). This took care of a memory leak users were seeing. Ironically, it turns out the implementation and user patterns in mbed-os was relying on this memory leak to avoid a double free in the same case of an error during mount.
The issue was that a failed mount would leave the LittleFileSystem class in a state where it thought it was mounted, and later it would attempt to unmount the filesystem. With the previous memory leak this would be "ok", and the leaked memory would be freed. But with the fix in v1.6, no memory is leaked, and the incorrect free triggers a hard fault.
Fixed to clean up state properly on failed mounts.
Pull request type
Build number : 2861
Build number : 2491
Aug 23, 2018
15 checks passed
Build number : 2504