https://git.reactos.org/?p=reactos.git;a=commitdiff;h=221ed8814121e5fb5af5e5...
commit 221ed8814121e5fb5af5e56a9197d34e9c091824 Author: Pierre Schweitzer pierre@reactos.org AuthorDate: Sat Jun 1 13:54:15 2019 +0200 Commit: Pierre Schweitzer pierre@reactos.org CommitDate: Sat Jun 1 13:54:34 2019 +0200
[NTOSKRNL] De-duplicate code between Ob(f)DereferenceDeviceMap functions --- ntoskrnl/ob/devicemap.c | 29 ++--------------------------- 1 file changed, 2 insertions(+), 27 deletions(-)
diff --git a/ntoskrnl/ob/devicemap.c b/ntoskrnl/ob/devicemap.c index c79838bbabd..8cda474a38d 100644 --- a/ntoskrnl/ob/devicemap.c +++ b/ntoskrnl/ob/devicemap.c @@ -156,33 +156,8 @@ ObDereferenceDeviceMap(IN PEPROCESS Process) KeReleaseGuardedMutex(&ObpDeviceMapLock);
/* Continue only if there is a device map */ - if (DeviceMap == NULL) - return; - - /* Acquire the device map lock again */ - KeAcquireGuardedMutex(&ObpDeviceMapLock); - - /* Decrement the reference counter */ - DeviceMap->ReferenceCount--; - DPRINT("ReferenceCount: %lu\n", DeviceMap->ReferenceCount); - - /* Leave, if there are still references to this device map */ - if (DeviceMap->ReferenceCount != 0) - { - /* Release the device map lock and leave */ - KeReleaseGuardedMutex(&ObpDeviceMapLock); - return; - } - - /* Nobody is referencing it anymore, unlink the DOS directory */ - DeviceMap->DosDevicesDirectory->DeviceMap = NULL; - - /* Release the device map lock */ - KeReleaseGuardedMutex(&ObpDeviceMapLock); - - /* Dereference the DOS Devices Directory and free the DeviceMap */ - ObDereferenceObject(DeviceMap->DosDevicesDirectory); - ExFreePoolWithTag(DeviceMap, 'mDbO'); + if (DeviceMap != NULL) + ObfDereferenceDeviceMap(DeviceMap); }