[UDFS] Avoid freeing Vcb when it couldn't have been allocated in UDFPnpSurpriseRemove()
authorVictor Martinez <vicmarcal@gmail.com>
Sat, 17 Aug 2019 13:44:57 +0000 (16:44 +0300)
committerVictor Perevertkin <victor@perevertkin.ru>
Sat, 17 Aug 2019 13:49:11 +0000 (16:49 +0300)
CORE-11203

drivers/filesystems/udfs/pnp.cpp

index 61db744..fa24c84 100644 (file)
@@ -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;