mirror of
https://github.com/reactos/reactos
synced 2025-10-06 00:12:51 +02:00
[HALX86] HalpDmaAllocateChildAdapter(): Fix memory leak, on error (#4156)
Simplify code, instead of adding 2 missing ObDereferenceObject(). (Note that ObInsertObject() always dereferences the object in case of failure.) CORE-17904
This commit is contained in:
@@ -477,12 +477,6 @@ HalpDmaAllocateChildAdapter(IN ULONG NumberOfMapRegisters,
|
||||
(PVOID)&AdapterObject);
|
||||
if (!NT_SUCCESS(Status)) return NULL;
|
||||
|
||||
Status = ObReferenceObjectByPointer(AdapterObject,
|
||||
FILE_READ_DATA | FILE_WRITE_DATA,
|
||||
IoAdapterObjectType,
|
||||
KernelMode);
|
||||
if (!NT_SUCCESS(Status)) return NULL;
|
||||
|
||||
RtlZeroMemory(AdapterObject, sizeof(ADAPTER_OBJECT));
|
||||
|
||||
Status = ObInsertObject(AdapterObject,
|
||||
@@ -493,6 +487,8 @@ HalpDmaAllocateChildAdapter(IN ULONG NumberOfMapRegisters,
|
||||
&Handle);
|
||||
if (!NT_SUCCESS(Status)) return NULL;
|
||||
|
||||
ObReferenceObject(AdapterObject);
|
||||
|
||||
ZwClose(Handle);
|
||||
|
||||
AdapterObject->DmaHeader.Version = (USHORT)DeviceDescription->Version;
|
||||
|
Reference in New Issue
Block a user