Fix driver loading. patch by tinus
Modified: trunk/reactos/ntoskrnl/io/driver.c

Modified: trunk/reactos/ntoskrnl/io/driver.c
--- trunk/reactos/ntoskrnl/io/driver.c	2005-05-07 01:13:04 UTC (rev 15069)
+++ trunk/reactos/ntoskrnl/io/driver.c	2005-05-07 01:17:36 UTC (rev 15070)
@@ -916,8 +916,20 @@
 				  NULL);
   if (!NT_SUCCESS(Status) || Service->Start > 1)
     {
-      ExFreePool(Service->ServiceGroup.Buffer);
-      ExFreePool(Service->ImagePath.Buffer);
+      /*
+       * If something goes wrong during RtlQueryRegistryValues
+       * it'll just drop everything on the floor and return,
+       * so you have to check if the buffers were filled.
+       * Luckily we zerofilled the Service.
+       */
+      if (Service->ServiceGroup.Buffer)
+        {
+          ExFreePool(Service->ServiceGroup.Buffer);
+        }
+      if (Service->ImagePath.Buffer)
+        {
+          ExFreePool(Service->ImagePath.Buffer);
+        }
       ExFreePool(Service);
       return(Status);
     }