* Call RtlCreateUnicodeString() instead of RtlInitUnicodeString() when

initializing the DeviceNode->ServiceName, since IopFreeDeviceNode()
  will use RtlFreeUnicodeString() on it.

* Call ObDereferenceObject() instead of ExFreePool() to release the
  DeviceObject if DriverEntry fails.
  Patch from Joseph Galbraith.

svn path=/trunk/; revision=3053
This commit is contained in:
Casper Hornstrup 2002-06-12 14:05:03 +00:00
parent 72a2cedd0a
commit a07b0d8b8e
3 changed files with 6 additions and 8 deletions

View file

@ -1,4 +1,4 @@
/* $Id: device.c,v 1.43 2002/06/10 23:03:33 ekohl Exp $
/* $Id: device.c,v 1.44 2002/06/12 14:05:03 chorns Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -529,7 +529,7 @@ IopInitializeDriver(PDRIVER_INITIALIZE DriverEntry,
{
DeviceNode->DriverObject = NULL;
ExFreePool(DriverObject->DriverExtension);
ExFreePool(DriverObject);
ObDereferenceObject(DriverObject);
return(Status);
}

View file

@ -1,4 +1,4 @@
/* $Id: driver.c,v 1.2 2002/06/10 23:03:33 ekohl Exp $
/* $Id: driver.c,v 1.3 2002/06/12 14:05:03 chorns Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -142,8 +142,7 @@ NtLoadDriver(IN PUNICODE_STRING DriverServiceName)
Length = wcslen(Start);
wcsncpy(Buffer, Start, Length);
RtlInitUnicodeString(&DeviceNode->ServiceName, Buffer);
RtlCreateUnicodeString(&DeviceNode->ServiceName, Buffer);
Status = IopInitializeDriver(ModuleObject->EntryPoint, DeviceNode);
if (!NT_SUCCESS(Status))

View file

@ -1,4 +1,4 @@
/* $Id: loader.c,v 1.108 2002/06/11 18:37:23 ekohl Exp $
/* $Id: loader.c,v 1.109 2002/06/12 14:05:03 chorns Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -1103,8 +1103,7 @@ LdrInitializeBootStartDriver(PVOID ModuleLoadBase,
Length = wcslen(Start);
wcsncpy(Buffer, Start, Length);
RtlInitUnicodeString(&DeviceNode->ServiceName, Buffer);
RtlCreateUnicodeString(&DeviceNode->ServiceName, Buffer);
Status = IopInitializeDriver(ModuleObject->EntryPoint, DeviceNode);
if (!NT_SUCCESS(Status))