Author: hbelusca
Date: Mon May 8 00:58:45 2017
New Revision: 74495
URL:
http://svn.reactos.org/svn/reactos?rev=74495&view=rev
Log:
[NTOS]: Addendums to r74491 and r74493:
- Free the FullServiceName buffer if PnpRootCreateDevice failed (erroneously committed in
r74494, see pnpmgr.c line 1080);
- No need to close InstanceHandle if the IopCreateDeviceKeyPath call failed, since in this
case the registry handle wasn't opened. CORE-13207
- Don't assert on Buffer allocation but return a proper failure code in case of
failure. CORE-13208
These are suggestions from Serge Gautherie + Lesan Ilie.
- Add a forgotten ZwClose call in the success code path of IopCreateDeviceKeyPath in
IopQueryDeviceCapabilities (by me).
Modified:
trunk/reactos/ntoskrnl/io/iomgr/driver.c
trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c
Modified: trunk/reactos/ntoskrnl/io/iomgr/driver.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/driver.c…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/driver.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/driver.c [iso-8859-1] Mon May 8 00:58:45 2017
@@ -899,7 +899,10 @@
InbvIndicateProgress();
Buffer = ExAllocatePool(PagedPool, ModuleName->Length + sizeof(UNICODE_NULL));
- ASSERT(Buffer);
+ if (Buffer == NULL)
+ {
+ return STATUS_INSUFFICIENT_RESOURCES;
+ }
RtlCopyMemory(Buffer, ModuleName->Buffer, ModuleName->Length);
Buffer[ModuleName->Length / sizeof(WCHAR)] = UNICODE_NULL;
Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.…
==============================================================================
--- trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c [iso-8859-1] Mon May 8 00:58:45 2017
@@ -892,6 +892,8 @@
&DeviceCaps->UINumber,
sizeof(ULONG));
}
+
+ ZwClose(InstanceKey);
}
return Status;
@@ -1086,7 +1088,6 @@
Status = IopCreateDeviceKeyPath(&Node->InstancePath, REG_OPTION_VOLATILE,
&InstanceHandle);
if (!NT_SUCCESS(Status))
{
- ZwClose(InstanceHandle);
ExFreePool(FullServiceName.Buffer);
ExFreePoolWithTag(Node, TAG_IO_DEVNODE);
return Status;