Author: sginsberg
Date: Wed Sep 24 11:37:35 2008
New Revision: 36487
URL:
http://svn.reactos.org/svn/reactos?rev=36487&view=rev
Log:
- IopGetDiskInformation: Fail if we are out of memory instead of dereferencing null
- Fix for Coverity error CID: 469
- Also fix a (potential) memory leak
Modified:
trunk/reactos/ntoskrnl/io/iomgr/arcname.c
Modified: trunk/reactos/ntoskrnl/io/iomgr/arcname.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/arcname.…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/arcname.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/arcname.c [iso-8859-1] Wed Sep 24 11:37:35 2008
@@ -217,7 +217,12 @@
PartitionBuffer = ExAllocatePoolWithTag(NonPagedPool,
DiskGeometry.BytesPerSector,
TAG_IO);
- if (!PartitionBuffer) return FALSE;
+ if (!PartitionBuffer)
+ {
+ /* Try again */
+ ExFreePoolWithTag(DriveLayout, TAG_FILE_SYSTEM);
+ return FALSE;
+ }
/* Build an IRP to read the partition sector */
KeInitializeEvent(&Event, NotificationEvent, FALSE);
@@ -228,6 +233,13 @@
&PartitionOffset,
&Event,
&StatusBlock);
+ if (!Irp)
+ {
+ /* Try again */
+ ExFreePoolWithTag(PartitionBuffer, TAG_IO);
+ ExFreePoolWithTag(DriveLayout, TAG_FILE_SYSTEM);
+ return FALSE;
+ }
/* Call the driver and check if we have to wait */
Status = IoCallDriver(DeviceObject, Irp);