From caedf961bbcca193c5d0794e96104d953470e380 Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Sun, 26 Oct 2014 15:35:18 +0000 Subject: [PATCH] [FASTFAT] Don't leak reference on failure in vfatPrepareTargetForRename(). svn path=/trunk/; revision=65013 --- reactos/drivers/filesystems/fastfat/finfo.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/reactos/drivers/filesystems/fastfat/finfo.c b/reactos/drivers/filesystems/fastfat/finfo.c index 87a30843b4b..b5199dac18d 100644 --- a/reactos/drivers/filesystems/fastfat/finfo.c +++ b/reactos/drivers/filesystems/fastfat/finfo.c @@ -400,6 +400,7 @@ vfatPrepareTargetForRename( /* If that's a directory or a read-only file, we're not allowed */ if (vfatFCBIsDirectory(TargetFcb) || ((*TargetFcb->Attributes & FILE_ATTRIBUTE_READONLY) == FILE_ATTRIBUTE_READONLY)); { + vfatReleaseFCB(DeviceExt, *ParentFCB); *ParentFCB = NULL; vfatReleaseFCB(DeviceExt, TargetFcb); return STATUS_OBJECT_NAME_COLLISION; @@ -408,6 +409,7 @@ vfatPrepareTargetForRename( /* Attempt to flush (might close the file) */ if (!MmFlushImageSection(TargetFcb->FileObject->SectionObjectPointer, MmFlushForDelete)) { + vfatReleaseFCB(DeviceExt, *ParentFCB); *ParentFCB = NULL; vfatReleaseFCB(DeviceExt, TargetFcb); return STATUS_ACCESS_DENIED; @@ -416,6 +418,7 @@ vfatPrepareTargetForRename( /* If we are, ensure the file isn't open by anyone! */ if (TargetFcb->OpenHandleCount != 0) { + vfatReleaseFCB(DeviceExt, *ParentFCB); *ParentFCB = NULL; vfatReleaseFCB(DeviceExt, TargetFcb); return STATUS_ACCESS_DENIED; @@ -429,6 +432,7 @@ vfatPrepareTargetForRename( } else { + vfatReleaseFCB(DeviceExt, *ParentFCB); *ParentFCB = NULL; vfatReleaseFCB(DeviceExt, TargetFcb); return STATUS_OBJECT_NAME_COLLISION;