Author: tkreuzer Date: Mon Oct 3 22:59:33 2011 New Revision: 53982 URL: http://svn.reactos.org/svn/reactos?rev=53982&view=rev Log: [FREELDR] Fix a bug, when the memory for a file cluster chain record was freed from the heap although it was still in use. Instead free the buffer when the file is closed.
Modified: trunk/reactos/boot/freeldr/freeldr/fs/fat.c Modified: trunk/reactos/boot/freeldr/freeldr/fs/fat.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/fs/fat.c?rev=53982&r1=53981&r2=53982&view=diff ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/fs/fat.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/fs/fat.c [iso-8859-1] Mon Oct 3 22:59:33 2011 @@ -804,8 +804,9 @@ return ENOTDIR; } DirectoryStartCluster = FatFileInfo.FileFatChain[0]; - } - MmHeapFree(FatFileInfo.FileFatChain); + MmHeapFree(FatFileInfo.FileFatChain); + FatFileInfo.FileFatChain = NULL; + } } memcpy(FatFileInfoPointer, &FatFileInfo, sizeof(FAT_FILE_INFO)); @@ -1332,6 +1333,7 @@ { PFAT_FILE_INFO FileHandle = FsGetDeviceSpecific(FileId); + if (FileHandle->FileFatChain) MmHeapFree(FileHandle->FileFatChain); MmHeapFree(FileHandle); return ESUCCESS;