https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d60acd88cb7e1a7a113c6…
commit d60acd88cb7e1a7a113c6d41c0e4d8be9ed9dab8
Author: Victor Martinez <vicmarcal(a)gmail.com>
AuthorDate: Sat Aug 17 16:44:57 2019 +0300
Commit: Victor Perevertkin <victor(a)perevertkin.ru>
CommitDate: Sat Aug 17 16:49:11 2019 +0300
[UDFS] Avoid freeing Vcb when it couldn't have been allocated in
UDFPnpSurpriseRemove()
CORE-11203
---
drivers/filesystems/udfs/pnp.cpp | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/filesystems/udfs/pnp.cpp b/drivers/filesystems/udfs/pnp.cpp
index 61db744d51f..fa24c84a3e3 100644
--- a/drivers/filesystems/udfs/pnp.cpp
+++ b/drivers/filesystems/udfs/pnp.cpp
@@ -588,7 +588,12 @@ Return Value:
// Knock as many files down for this volume as we can.
Vcb->Vpb->RealDevice->Flags |= DO_VERIFY_VOLUME;
Buf = (PPREVENT_MEDIA_REMOVAL_USER_IN)MyAllocatePool__(NonPagedPool,
sizeof(PREVENT_MEDIA_REMOVAL_USER_IN));
- if(!Buf) try_return(RC = STATUS_INSUFFICIENT_RESOURCES);
+ if(!Buf) {
+ VcbAcquired = FALSE;
+ VcbDeleted = FALSE;
+ try_return(RC = STATUS_INSUFFICIENT_RESOURCES);
+ }
+
UDFDoDismountSequence(Vcb, Buf, FALSE);
Vcb->VCBFlags &= ~UDF_VCB_FLAGS_VOLUME_MOUNTED;
Vcb->WriteSecurity = FALSE;