Real Time Engineers FreeRTOS+FAT 160919a has a use after free. The function FFClose() is defined in fffile.c. The file handler pxFile is freed by ffconfigFREE, which (by default) is a macro definition of vPortFree(), but it is reused to flush modified file content from the cache to disk by the function FFFlushCache().