- fixed uninitialized variable warning
authorThomas Bluemel <thomas@reactsoft.com>
Sun, 25 Sep 2005 17:49:14 +0000 (17:49 +0000)
committerThomas Bluemel <thomas@reactsoft.com>
Sun, 25 Sep 2005 17:49:14 +0000 (17:49 +0000)
- ProbeAndCaptureUnicodeString should check if allocating memory succeeded

svn path=/trunk/; revision=18061

reactos/ntoskrnl/include/internal/ntoskrnl.h
reactos/ntoskrnl/io/driver.c

index 44b750e..0d2c38a 100644 (file)
@@ -130,11 +130,16 @@ ProbeAndCaptureUnicodeString(OUT PUNICODE_STRING Dest,
     /* Allocate space for the buffer */
     Buffer = ExAllocatePool(PagedPool, Dest->MaximumLength);
 
     /* Allocate space for the buffer */
     Buffer = ExAllocatePool(PagedPool, Dest->MaximumLength);
 
-    /* Copy it */
-    RtlCopyMemory(Buffer, Dest->Buffer, Dest->MaximumLength);
+    if (Buffer != NULL)
+    {
+        /* Copy it */
+        RtlCopyMemory(Buffer, Dest->Buffer, Dest->MaximumLength);
 
 
-    /* Set it as the buffer */
-    Dest->Buffer = Buffer;
+        /* Set it as the buffer */
+        Dest->Buffer = Buffer;
+    }
+    else
+        Status = STATUS_INSUFFICIENT_RESOURCES;
 
     /* Return */
     return Status;
 
     /* Return */
     return Status;
index 23f6761..33fd808 100644 (file)
@@ -1852,7 +1852,7 @@ NtLoadDriver(IN PUNICODE_STRING DriverServiceName)
    RTL_QUERY_REGISTRY_TABLE QueryTable[3];
    UNICODE_STRING ImagePath;
    UNICODE_STRING ServiceName;
    RTL_QUERY_REGISTRY_TABLE QueryTable[3];
    UNICODE_STRING ImagePath;
    UNICODE_STRING ServiceName;
-   UNICODE_STRING CapturedDriverServiceName;
+   UNICODE_STRING CapturedDriverServiceName = {0};
    KPROCESSOR_MODE PreviousMode;
    NTSTATUS Status;
    ULONG Type;
    KPROCESSOR_MODE PreviousMode;
    NTSTATUS Status;
    ULONG Type;