Author: cgutman
Date: Mon Sep 29 19:02:53 2008
New Revision: 36592
URL:
http://svn.reactos.org/svn/reactos?rev=36592&view=rev
Log:
- Fix a memory leak
Modified:
branches/aicom-network-fixes/drivers/network/ndis/ndis/config.c
Modified: branches/aicom-network-fixes/drivers/network/ndis/ndis/config.c
URL:
http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/drivers/net…
==============================================================================
--- branches/aicom-network-fixes/drivers/network/ndis/ndis/config.c [iso-8859-1]
(original)
+++ branches/aicom-network-fixes/drivers/network/ndis/ndis/config.c [iso-8859-1] Mon Sep
29 19:02:53 2008
@@ -479,6 +479,15 @@
return;
}
+ MiniportResource = ExAllocatePool(PagedPool, sizeof(MINIPORT_RESOURCE));
+ if(!MiniportResource)
+ {
+ NDIS_DbgPrint(MIN_TRACE,("Insufficient resources.\n"));
+ ExFreePool(KeyInformation);
+ *Status = NDIS_STATUS_RESOURCES;
+ return;
+ }
+
switch(ParameterType)
{
case NdisParameterInteger:
@@ -516,8 +525,15 @@
ExFreePool(*ParameterValue);
*ParameterValue = NULL;
*Status = NDIS_STATUS_FAILURE;
- } else
- *Status = NDIS_STATUS_SUCCESS;
+ return;
+ }
+
+ MiniportResource->ResourceType = 0;
+ MiniportResource->Resource = *ParameterValue;
+ NDIS_DbgPrint(MID_TRACE,("inserting 0x%x into the resource list\n",
MiniportResource->Resource));
+ ExInterlockedInsertTailList(&ConfigurationContext->ResourceListHead,
&MiniportResource->ListEntry, &ConfigurationContext->ResourceLock);
+
+ *Status = NDIS_STATUS_SUCCESS;
return;
}
@@ -556,18 +572,6 @@
return;
}
- MiniportResource = ExAllocatePool(PagedPool, sizeof(MINIPORT_RESOURCE));
- if(!MiniportResource)
- {
- NDIS_DbgPrint(MIN_TRACE,("Insufficient resources.\n"));
- ExFreePool(RegData);
- ExFreePool(KeyInformation);
- ExFreePool(*ParameterValue);
- *ParameterValue = NULL;
- *Status = NDIS_STATUS_RESOURCES;
- return;
- }
-
MiniportResource->ResourceType = 0;
MiniportResource->Resource = *ParameterValue;
NDIS_DbgPrint(MID_TRACE,("inserting 0x%x into the resource list\n",
MiniportResource->Resource));
@@ -601,17 +605,6 @@
{
NDIS_DbgPrint(MIN_TRACE,("Insufficient resources.\n"));
ExFreePool(KeyInformation);
- *Status = NDIS_STATUS_RESOURCES;
- return;
- }
-
- MiniportResource = ExAllocatePool(PagedPool, sizeof(MINIPORT_RESOURCE));
- if(!MiniportResource)
- {
- NDIS_DbgPrint(MIN_TRACE,("Insufficient resources.\n"));
- ExFreePool(KeyInformation);
- ExFreePool(*ParameterValue);
- *ParameterValue = NULL;
*Status = NDIS_STATUS_RESOURCES;
return;
}