Author: hbelusca
Date: Mon Nov  7 15:51:56 2016
New Revision: 73170

URL: http://svn.reactos.org/svn/reactos?rev=73170&view=rev
Log:
[NTOS:IO]: IopCreateDriver(): Set the returned DriverObject value only in case 
of success.

Modified:
    trunk/reactos/ntoskrnl/io/iomgr/driver.c

Modified: trunk/reactos/ntoskrnl/io/iomgr/driver.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/driver.c?rev=73170&r1=73169&r2=73170&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/driver.c    [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/driver.c    [iso-8859-1] Mon Nov  7 
15:51:56 2016
@@ -527,12 +527,13 @@
     RtlFreeUnicodeString(&RegistryKey);
     RtlFreeUnicodeString(&DriverName);
 
-    *DriverObject = Driver;
     if (!NT_SUCCESS(Status))
     {
         DPRINT("IopCreateDriver() failed (Status 0x%08lx)\n", Status);
         return Status;
     }
+
+    *DriverObject = Driver;
 
     MmFreeDriverInitialization((PLDR_DATA_TABLE_ENTRY)Driver->DriverSection);
 
@@ -1426,7 +1427,7 @@
                                         &DriverReinitListLock);
     while (Entry)
     {
-        /* Get the item*/
+        /* Get the item */
         ReinitItem = CONTAINING_RECORD(Entry, DRIVER_REINIT_ITEM, ItemEntry);
 
         /* Increment reinitialization counter */
@@ -1462,7 +1463,7 @@
                                         &DriverBootReinitListLock);
     while (Entry)
     {
-        /* Get the item*/
+        /* Get the item */
         ReinitItem = CONTAINING_RECORD(Entry, DRIVER_REINIT_ITEM, ItemEntry);
 
         /* Increment reinitialization counter */
@@ -1510,7 +1511,7 @@
     /* First, create a unique name for the driver if we don't have one */
     if (!DriverName)
     {
-        /* Create a random name and set up the string*/
+        /* Create a random name and set up the string */
         NameLength = (USHORT)swprintf(NameBuffer,
                                       DRIVER_ROOT_NAME L"%08u",
                                       KeTickCount.LowPart);


Reply via email to