https://git.reactos.org/?p=reactos.git;a=commitdiff;h=55065d3b519eb02248c11acf354fe5261067e7d6

commit 55065d3b519eb02248c11acf354fe5261067e7d6
Author:     Katayama Hirofumi MZ <[email protected]>
AuthorDate: Thu Apr 28 22:16:37 2022 +0900
Commit:     GitHub <[email protected]>
CommitDate: Thu Apr 28 22:16:37 2022 +0900

    [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.
---
 ntoskrnl/io/pnpmgr/plugplay.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

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

Reply via email to