mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 22:46:17 +00:00
- Handle AllocatedResources and AllocatedResourcesTranslated separately
- Fix a memory leak - Fix a handle leak svn path=/branches/aicom-network-fixes/; revision=35964
This commit is contained in:
parent
16427a1482
commit
85672737e6
2 changed files with 19 additions and 11 deletions
|
@ -1293,8 +1293,7 @@ NdisIPnPStartDevice(
|
|||
* NdisMQueryAdapterResources.
|
||||
*/
|
||||
|
||||
if (Stack->Parameters.StartDevice.AllocatedResources != NULL &&
|
||||
Stack->Parameters.StartDevice.AllocatedResourcesTranslated != NULL)
|
||||
if (Stack->Parameters.StartDevice.AllocatedResources != NULL)
|
||||
{
|
||||
ResourceCount = Stack->Parameters.StartDevice.AllocatedResources->List[0].
|
||||
PartialResourceList.Count;
|
||||
|
@ -1310,24 +1309,31 @@ NdisIPnPStartDevice(
|
|||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
RtlCopyMemory(Adapter->NdisMiniportBlock.AllocatedResources,
|
||||
Stack->Parameters.StartDevice.AllocatedResources,
|
||||
ResourceListSize);
|
||||
}
|
||||
|
||||
if (Stack->Parameters.StartDevice.AllocatedResourcesTranslated != NULL)
|
||||
{
|
||||
ResourceCount = Stack->Parameters.StartDevice.AllocatedResources->List[0].
|
||||
PartialResourceList.Count;
|
||||
ResourceListSize =
|
||||
FIELD_OFFSET(CM_RESOURCE_LIST, List[0].PartialResourceList.
|
||||
PartialDescriptors[ResourceCount]);
|
||||
|
||||
Adapter->NdisMiniportBlock.AllocatedResourcesTranslated =
|
||||
ExAllocatePool(PagedPool, ResourceListSize);
|
||||
if (Adapter->NdisMiniportBlock.AllocatedResourcesTranslated == NULL)
|
||||
{
|
||||
ExFreePool(Adapter->NdisMiniportBlock.AllocatedResources);
|
||||
Adapter->NdisMiniportBlock.AllocatedResources = NULL;
|
||||
ExInterlockedRemoveEntryList( &Adapter->ListEntry, &AdapterListLock );
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
RtlCopyMemory(Adapter->NdisMiniportBlock.AllocatedResources,
|
||||
Stack->Parameters.StartDevice.AllocatedResources,
|
||||
ResourceListSize);
|
||||
|
||||
RtlCopyMemory(Adapter->NdisMiniportBlock.AllocatedResourcesTranslated,
|
||||
Stack->Parameters.StartDevice.AllocatedResourcesTranslated,
|
||||
ResourceListSize);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Store the Bus Type, Bus Number and Slot information. It's used by
|
||||
|
|
|
@ -805,10 +805,11 @@ NdisRegisterProtocol(
|
|||
NtStatus = ZwQueryValueKey(DriverKeyHandle, &ValueName, KeyValuePartialInformation, KeyInformation,
|
||||
sizeof(KEY_VALUE_PARTIAL_INFORMATION) + ResultLength, &ResultLength);
|
||||
|
||||
ZwClose(DriverKeyHandle);
|
||||
|
||||
if(!NT_SUCCESS(NtStatus))
|
||||
{
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Unable to query the Bind value\n"));
|
||||
ZwClose(DriverKeyHandle);
|
||||
ExFreePool(KeyInformation);
|
||||
ExFreePool(Protocol);
|
||||
*Status = NDIS_STATUS_FAILURE;
|
||||
|
@ -893,7 +894,8 @@ NdisRegisterProtocol(
|
|||
*/
|
||||
}
|
||||
|
||||
*Status = NDIS_STATUS_SUCCESS;
|
||||
ExFreePool(KeyInformation);
|
||||
*Status = NDIS_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue