From de5cff4b3753f1e3db60595b0b757638a904d7c2 Mon Sep 17 00:00:00 2001 From: Trevor Thompson Date: Fri, 8 Jul 2016 12:05:19 +0000 Subject: [PATCH] [NTFS] Fix broken check for free disk space in NtfsAllocateClusters(). svn path=/branches/GSoC_2016/NTFS/; revision=71858 --- drivers/filesystems/ntfs/volinfo.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/filesystems/ntfs/volinfo.c b/drivers/filesystems/ntfs/volinfo.c index 68a10506207..d1505a5fb24 100644 --- a/drivers/filesystems/ntfs/volinfo.c +++ b/drivers/filesystems/ntfs/volinfo.c @@ -162,8 +162,14 @@ NtfsAllocateClusters(PDEVICE_EXTENSION DeviceExt, RtlInitializeBitMap(&Bitmap, (PULONG)BitmapData, DeviceExt->NtfsInfo.ClusterCount); FreeClusters = RtlNumberOfClearBits(&Bitmap); - if( FreeClusters < DesiredClusters ) - Status = STATUS_DISK_FULL; + if (FreeClusters < DesiredClusters) + { + ReleaseAttributeContext(DataContext); + + ExFreePoolWithTag(BitmapData, TAG_NTFS); + ExFreePoolWithTag(BitmapRecord, TAG_NTFS); + return STATUS_DISK_FULL; + } // TODO: Observe MFT reservation zone