[NTOS:PNP] Fix GCC build (ignoring return value) (#4473)

[NTOS:PNP] Fix GCC build (ignoring return value)

Properly handle RtlDuplicateUnicodeString return status. Addendum to de316477. Thanks to @HBelusca and @Doug-Lyons.
This commit is contained in:
Katayama Hirofumi MZ 2022-04-28 22:16:37 +09:00 committed by GitHub
parent de316477b9
commit 55065d3b51
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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);