diff --git a/ntoskrnl/io/pnpmgr/plugplay.c b/ntoskrnl/io/pnpmgr/plugplay.c index 46093b252b5..e3412c4cfa3 100644 --- a/ntoskrnl/io/pnpmgr/plugplay.c +++ b/ntoskrnl/io/pnpmgr/plugplay.c @@ -245,8 +245,14 @@ IopInitializeDevice( } /* Set the device instance of the device node */ - RtlDuplicateUnicodeString(0, &DeviceInstance, &DeviceNode->InstancePath); - + Status = RtlDuplicateUnicodeString(0, &DeviceInstance, &DeviceNode->InstancePath); + if (!NT_SUCCESS(Status)) + { + DPRINT1("RtlDuplicateUnicodeString() failed (Status 0x%08lx)\n", Status); + IopFreeDeviceNode(DeviceNode); + IoDeleteDevice(DeviceObject); + goto done; + } /* Insert as a root enumerated device node */ PiInsertDevNode(DeviceNode, IopRootDeviceNode);