mirror of
https://github.com/reactos/reactos.git
synced 2024-12-26 17:14:41 +00: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:
parent
2196a06fc1
commit
0fd3e51580
1 changed files with 2 additions and 6 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue