https://git.reactos.org/?p=reactos.git;a=commitdiff;h=de5cff4b3753f1e3db605…
commit de5cff4b3753f1e3db60595b0b757638a904d7c2
Author: Trevor Thompson <tmt256(a)email.vccs.edu>
AuthorDate: Fri Jul 8 12:05:19 2016 +0000
[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 68a1050620..d1505a5fb2 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