From cb5688fcf00c7c53a16c32a940625156353f5a0b Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Sun, 26 Oct 2014 15:56:20 +0000 Subject: [PATCH] [FASTFAT] Make FATGetNextDirEntry() and vfatFindDirSpace() complain when they are given a cleaned up FCB (which shouldn't happen!). They'll display full path, references count, open handles count. Where are you little reference leak? svn path=/trunk/; revision=65014 --- reactos/drivers/filesystems/fastfat/direntry.c | 6 ++++++ reactos/drivers/filesystems/fastfat/dirwr.c | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/reactos/drivers/filesystems/fastfat/direntry.c b/reactos/drivers/filesystems/fastfat/direntry.c index 336f014ad5f..f3dc5b9fb06 100644 --- a/reactos/drivers/filesystems/fastfat/direntry.c +++ b/reactos/drivers/filesystems/fastfat/direntry.c @@ -201,6 +201,12 @@ FATGetNextDirEntry( CcUnpinData(*pContext); } + if (!pDirFcb->FileObject) + { + DPRINT1("Buggy FCB (cleaned up)! %S (%d / %u)\n", pDirFcb->PathNameBuffer, pDirFcb->RefCount, pDirFcb->OpenHandleCount); + return STATUS_NO_MORE_ENTRIES; + } + if (FileOffset.u.LowPart >= pDirFcb->RFCB.FileSize.u.LowPart || !CcMapData(pDirFcb->FileObject, &FileOffset, PAGE_SIZE, TRUE, pContext, pPage)) { diff --git a/reactos/drivers/filesystems/fastfat/dirwr.c b/reactos/drivers/filesystems/fastfat/dirwr.c index 21b0e6945c0..e9622a846f1 100644 --- a/reactos/drivers/filesystems/fastfat/dirwr.c +++ b/reactos/drivers/filesystems/fastfat/dirwr.c @@ -167,6 +167,11 @@ vfatFindDirSpace( { CcUnpinData(Context); } + if (!pDirFcb->FileObject) + { + DPRINT1("Buggy FCB (cleaned up)! %S (%d / %u)\n", pDirFcb->PathNameBuffer, pDirFcb->RefCount, pDirFcb->OpenHandleCount); + return FALSE; + } if (!CcPinRead(pDirFcb->FileObject, &FileOffset, DeviceExt->FatInfo.BytesPerCluster, TRUE, &Context, (PVOID*)&pFatEntry)) { -- 2.17.1