Author: hbelusca Date: Sat Oct 6 18:46:13 2012 New Revision: 57499 URL: http://svn.reactos.org/svn/reactos?rev=57499&view=rev Log: [NTOSKRNL] Fix Coverity defects : CID 716579, 716580 and 716582.
Modified: trunk/reactos/ntoskrnl/fstub/fstubex.c trunk/reactos/ntoskrnl/io/iomgr/driver.c trunk/reactos/ntoskrnl/io/iomgr/error.c Modified: trunk/reactos/ntoskrnl/fstub/fstubex.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/fstub/fstubex.c?rev=57499&r1=57498&r2=57499&view=diff ============================================================================== --- trunk/reactos/ntoskrnl/fstub/fstubex.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/fstub/fstubex.c [iso-8859-1] Sat Oct 6 18:46:13 2012 @@ -1605,7 +1605,7 @@ DriveLayout); /* Free allocated structure and return */ - ExFreePool(DriveLayout); + ExFreePoolWithTag(DriveLayout, 'BtsF'); return Status; } Modified: trunk/reactos/ntoskrnl/io/iomgr/driver.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/driver.c?rev=57499&r1=57498&r2=57499&view=diff ============================================================================== --- trunk/reactos/ntoskrnl/io/iomgr/driver.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/iomgr/driver.c [iso-8859-1] Sat Oct 6 18:46:13 2012 @@ -1770,7 +1770,7 @@ if (!Inserted) { /* Free the entry and fail */ - ExFreePool(NewDriverExtension); + ExFreePoolWithTag(NewDriverExtension, TAG_DRIVER_EXTENSION); return STATUS_OBJECT_NAME_COLLISION; } Modified: trunk/reactos/ntoskrnl/io/iomgr/error.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/error.c?rev=57499&r1=57498&r2=57499&view=diff ============================================================================== --- trunk/reactos/ntoskrnl/io/iomgr/error.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/iomgr/error.c [iso-8859-1] Sat Oct 6 18:46:13 2012 @@ -486,14 +486,33 @@ { PERROR_LOG_ENTRY LogEntry; ULONG LogEntrySize; + PDEVICE_OBJECT DeviceObject; PDRIVER_OBJECT DriverObject; - PDEVICE_OBJECT DeviceObject; /* Make sure we have an object */ if (!IoObject) return NULL; /* Check if we're past our buffer */ if (IopTotalLogSize > PAGE_SIZE) return NULL; + + /* Check if this is a device object or driver object */ + if (((PDEVICE_OBJECT)IoObject)->Type == IO_TYPE_DEVICE) + { + /* It's a device, get the driver */ + DeviceObject = (PDEVICE_OBJECT)IoObject; + DriverObject = DeviceObject->DriverObject; + } + else if (((PDEVICE_OBJECT)IoObject)->Type == IO_TYPE_DRIVER) + { + /* It's a driver, so we don't have a device */ + DeviceObject = NULL; + DriverObject = (PDRIVER_OBJECT)IoObject; + } + else + { + /* Fail */ + return NULL; + } /* Calculate the total size and allocate it */ LogEntrySize = sizeof(ERROR_LOG_ENTRY) + EntrySize; @@ -501,25 +520,6 @@ LogEntrySize, TAG_ERROR_LOG); if (!LogEntry) return NULL; - - /* Check if this is a device object or driver object */ - if (((PDEVICE_OBJECT)IoObject)->Type == IO_TYPE_DEVICE) - { - /* It's a device, get the driver */ - DeviceObject = (PDEVICE_OBJECT)IoObject; - DriverObject = DeviceObject->DriverObject; - } - else if (((PDEVICE_OBJECT)IoObject)->Type == IO_TYPE_DRIVER) - { - /* It's a driver, so we don' thave a device */ - DeviceObject = NULL; - DriverObject = IoObject; - } - else - { - /* Fail */ - return NULL; - } /* Reference the Objects */ if (DeviceObject) ObReferenceObject(DeviceObject);