Author: hbelusca
Date: Mon May 8 00:51:44 2017
New Revision: 74494
URL:
http://svn.reactos.org/svn/reactos?rev=74494&view=rev
Log:
[NTOS]: Code formatting + free the memory in the reverse order from how it was allocated.
Modified:
trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c
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:51:44 2017
@@ -878,7 +878,7 @@
&ValueName,
0,
REG_DWORD,
- (PVOID)&DeviceNode->CapabilityFlags,
+ &DeviceNode->CapabilityFlags,
sizeof(ULONG));
/* Set 'UINumber' value */
@@ -1077,6 +1077,7 @@
if (!NT_SUCCESS(Status))
{
DPRINT1("PnpRootCreateDevice() failed with status 0x%08X\n", Status);
+ ExFreePool(FullServiceName.Buffer);
ExFreePoolWithTag(Node, TAG_IO_DEVNODE);
return Status;
}
@@ -1086,8 +1087,8 @@
if (!NT_SUCCESS(Status))
{
ZwClose(InstanceHandle);
+ ExFreePool(FullServiceName.Buffer);
ExFreePoolWithTag(Node, TAG_IO_DEVNODE);
- ExFreePool(FullServiceName.Buffer);
return Status;
}
@@ -1095,8 +1096,8 @@
if (!Node->ServiceName.Buffer)
{
ZwClose(InstanceHandle);
+ ExFreePool(FullServiceName.Buffer);
ExFreePoolWithTag(Node, TAG_IO_DEVNODE);
- ExFreePool(FullServiceName.Buffer);
return Status;
}
@@ -1738,7 +1739,7 @@
&ValueName,
0,
REG_SZ,
- (PVOID)KeyValue.Buffer,
+ KeyValue.Buffer,
((ULONG)wcslen(KeyValue.Buffer) + 1) * sizeof(WCHAR));
cleanup:
@@ -1859,11 +1860,11 @@
RtlInitUnicodeString(&ValueName, L"CompatibleIDs");
Status = ZwSetValueKey(InstanceKey,
- &ValueName,
- 0,
- REG_MULTI_SZ,
- (PVOID)IoStatusBlock.Information,
- (TotalLength + 1) * sizeof(WCHAR));
+ &ValueName,
+ 0,
+ REG_MULTI_SZ,
+ (PVOID)IoStatusBlock.Information,
+ (TotalLength + 1) * sizeof(WCHAR));
if (!NT_SUCCESS(Status))
{
DPRINT1("ZwSetValueKey() failed (Status %lx) or no Compatible ID
returned\n", Status);