mirror of
https://github.com/reactos/reactos.git
synced 2025-01-06 06:20:13 +00:00
- IopGetDiskInformation: Fail if we are out of memory instead of dereferencing null
- Fix for Coverity error CID: 469 - Also fix a (potential) memory leak svn path=/trunk/; revision=36487
This commit is contained in:
parent
e57cfa2826
commit
d91564734d
1 changed files with 13 additions and 1 deletions
|
@ -217,7 +217,12 @@ IopGetDiskInformation(IN ULONG i,
|
||||||
PartitionBuffer = ExAllocatePoolWithTag(NonPagedPool,
|
PartitionBuffer = ExAllocatePoolWithTag(NonPagedPool,
|
||||||
DiskGeometry.BytesPerSector,
|
DiskGeometry.BytesPerSector,
|
||||||
TAG_IO);
|
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 */
|
/* Build an IRP to read the partition sector */
|
||||||
KeInitializeEvent(&Event, NotificationEvent, FALSE);
|
KeInitializeEvent(&Event, NotificationEvent, FALSE);
|
||||||
|
@ -228,6 +233,13 @@ IopGetDiskInformation(IN ULONG i,
|
||||||
&PartitionOffset,
|
&PartitionOffset,
|
||||||
&Event,
|
&Event,
|
||||||
&StatusBlock);
|
&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 */
|
/* Call the driver and check if we have to wait */
|
||||||
Status = IoCallDriver(DeviceObject, Irp);
|
Status = IoCallDriver(DeviceObject, Irp);
|
||||||
|
|
Loading…
Reference in a new issue