From 9893e19698e5110dfd1f54a8f31e93ff47973b28 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Mon, 3 Oct 2011 22:59:33 +0000 Subject: [PATCH] [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. svn path=/trunk/; revision=53982 --- reactos/boot/freeldr/freeldr/fs/fat.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/reactos/boot/freeldr/freeldr/fs/fat.c b/reactos/boot/freeldr/freeldr/fs/fat.c index 643be7b6daa..a6f5319315e 100644 --- a/reactos/boot/freeldr/freeldr/fs/fat.c +++ b/reactos/boot/freeldr/freeldr/fs/fat.c @@ -804,8 +804,9 @@ LONG FatLookupFile(PFAT_VOLUME_INFO Volume, PCSTR FileName, ULONG DeviceId, PFAT return ENOTDIR; } DirectoryStartCluster = FatFileInfo.FileFatChain[0]; + MmHeapFree(FatFileInfo.FileFatChain); + FatFileInfo.FileFatChain = NULL; } - MmHeapFree(FatFileInfo.FileFatChain); } memcpy(FatFileInfoPointer, &FatFileInfo, sizeof(FAT_FILE_INFO)); @@ -1332,6 +1333,7 @@ LONG FatClose(ULONG FileId) { PFAT_FILE_INFO FileHandle = FsGetDeviceSpecific(FileId); + if (FileHandle->FileFatChain) MmHeapFree(FileHandle->FileFatChain); MmHeapFree(FileHandle); return ESUCCESS;