A patch for FreeRTOS+FAT ( FF_Close )

heinbali01 wrote on Friday, October 25, 2019:

In ff_file.c, around line 2962:

-    ffconfigFREE( pxFile );
     if( FF_isERR( xError ) == pdFALSE )
     {
         xError = FF_FlushCache( pxFile->pxIOManager ); /* Ensure all modified blocks are flushed to disk! */
     }
+    ffconfigFREE( pxFile );

When the function FF_FlushCache() is called, the value of pxFile->pxIOManager may have become invalid.
This could happen in case there is a task switch between ffconfigFREE() and calling FF_FlushCache(), and another task has allocated and changed the same memory.

Hein

rtel wrote on Friday, October 25, 2019:

Thanks - will update and re-issue the zip.