[NTOSKRNL]

Fix Coverity defects : CID 716579, 716580 and 716582.

svn path=/trunk/; revision=57499
This commit is contained in:
Hermès Bélusca-Maïto 2012-10-06 18:46:13 +00:00
parent ae50229cb5
commit ebd10c73a3
3 changed files with 12 additions and 12 deletions

View file

@ -1605,7 +1605,7 @@ FstubWritePartitionTableMBR(IN PDISK_INFORMATION Disk,
DriveLayout); DriveLayout);
/* Free allocated structure and return */ /* Free allocated structure and return */
ExFreePool(DriveLayout); ExFreePoolWithTag(DriveLayout, 'BtsF');
return Status; return Status;
} }

View file

@ -1770,7 +1770,7 @@ IoAllocateDriverObjectExtension(IN PDRIVER_OBJECT DriverObject,
if (!Inserted) if (!Inserted)
{ {
/* Free the entry and fail */ /* Free the entry and fail */
ExFreePool(NewDriverExtension); ExFreePoolWithTag(NewDriverExtension, TAG_DRIVER_EXTENSION);
return STATUS_OBJECT_NAME_COLLISION; return STATUS_OBJECT_NAME_COLLISION;
} }

View file

@ -486,8 +486,8 @@ IoAllocateErrorLogEntry(IN PVOID IoObject,
{ {
PERROR_LOG_ENTRY LogEntry; PERROR_LOG_ENTRY LogEntry;
ULONG LogEntrySize; ULONG LogEntrySize;
PDRIVER_OBJECT DriverObject;
PDEVICE_OBJECT DeviceObject; PDEVICE_OBJECT DeviceObject;
PDRIVER_OBJECT DriverObject;
/* Make sure we have an object */ /* Make sure we have an object */
if (!IoObject) return NULL; if (!IoObject) return NULL;
@ -495,13 +495,6 @@ IoAllocateErrorLogEntry(IN PVOID IoObject,
/* Check if we're past our buffer */ /* Check if we're past our buffer */
if (IopTotalLogSize > PAGE_SIZE) return NULL; if (IopTotalLogSize > PAGE_SIZE) return NULL;
/* Calculate the total size and allocate it */
LogEntrySize = sizeof(ERROR_LOG_ENTRY) + EntrySize;
LogEntry = ExAllocatePoolWithTag(NonPagedPool,
LogEntrySize,
TAG_ERROR_LOG);
if (!LogEntry) return NULL;
/* Check if this is a device object or driver object */ /* Check if this is a device object or driver object */
if (((PDEVICE_OBJECT)IoObject)->Type == IO_TYPE_DEVICE) if (((PDEVICE_OBJECT)IoObject)->Type == IO_TYPE_DEVICE)
{ {
@ -511,9 +504,9 @@ IoAllocateErrorLogEntry(IN PVOID IoObject,
} }
else if (((PDEVICE_OBJECT)IoObject)->Type == IO_TYPE_DRIVER) else if (((PDEVICE_OBJECT)IoObject)->Type == IO_TYPE_DRIVER)
{ {
/* It's a driver, so we don' thave a device */ /* It's a driver, so we don't have a device */
DeviceObject = NULL; DeviceObject = NULL;
DriverObject = IoObject; DriverObject = (PDRIVER_OBJECT)IoObject;
} }
else else
{ {
@ -521,6 +514,13 @@ IoAllocateErrorLogEntry(IN PVOID IoObject,
return NULL; return NULL;
} }
/* Calculate the total size and allocate it */
LogEntrySize = sizeof(ERROR_LOG_ENTRY) + EntrySize;
LogEntry = ExAllocatePoolWithTag(NonPagedPool,
LogEntrySize,
TAG_ERROR_LOG);
if (!LogEntry) return NULL;
/* Reference the Objects */ /* Reference the Objects */
if (DeviceObject) ObReferenceObject(DeviceObject); if (DeviceObject) ObReferenceObject(DeviceObject);
if (DriverObject) ObReferenceObject(DriverObject); if (DriverObject) ObReferenceObject(DriverObject);