Author: cgutman Date: Sun May 29 16:44:34 2011 New Revision: 51997
URL: http://svn.reactos.org/svn/reactos?rev=51997&view=rev Log: [NTOSKRNL] - Fix a reference leak which prevented driver objects passed to IoRegisterPlugPlayNotification from being able to unload after the notification was unregistered - Fix a non-paged pool leak
Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpnotify.c
Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpnotify.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnpnotif... ============================================================================== --- trunk/reactos/ntoskrnl/io/pnpmgr/pnpnotify.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/pnpmgr/pnpnotify.c [iso-8859-1] Sun May 29 16:44:34 2011 @@ -23,6 +23,7 @@ PVOID Context; UNICODE_STRING Guid; PFILE_OBJECT FileObject; + PDRIVER_OBJECT DriverObject; PDRIVER_NOTIFICATION_CALLBACK_ROUTINE PnpNotificationProc; } PNP_NOTIFY_ENTRY, *PPNP_NOTIFY_ENTRY;
@@ -319,6 +320,7 @@ Entry->PnpNotificationProc = CallbackRoutine; Entry->EventCategory = EventCategory; Entry->Context = Context; + Entry->DriverObject = DriverObject; switch (EventCategory) { case EventCategoryDeviceInterfaceChange: @@ -377,9 +379,14 @@ DPRINT("__FUNCTION__(NotificationEntry %p) called\n", Entry);
KeAcquireGuardedMutex(&PnpNotifyListLock); - RtlFreeUnicodeString(&Entry->Guid); RemoveEntryList(&Entry->PnpNotifyList); KeReleaseGuardedMutex(&PnpNotifyListLock);
+ RtlFreeUnicodeString(&Entry->Guid); + + ObDereferenceObject(Entry->DriverObject); + + ExFreePoolWithTag(Entry, TAG_PNP_NOTIFY); + return STATUS_SUCCESS; }