Author: cgutman
Date: Sun Aug 31 22:13:35 2008
New Revision: 35848
URL:
http://svn.reactos.org/svn/reactos?rev=35848&view=rev
Log:
- Initially set PoolHandle, ConfigurationHandle, KeyHandle, and Filter to NULL
- Initially set PortOffset to 0
- Fix 4 memory leaks
- Remove a useless if
Modified:
branches/aicom-network-fixes/drivers/network/ndis/ndis/buffer.c
branches/aicom-network-fixes/drivers/network/ndis/ndis/config.c
branches/aicom-network-fixes/drivers/network/ndis/ndis/efilter.c
branches/aicom-network-fixes/drivers/network/ndis/ndis/io.c
branches/aicom-network-fixes/drivers/network/ndis/ndis/miniport.c
Modified: branches/aicom-network-fixes/drivers/network/ndis/ndis/buffer.c
URL:
http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/drivers/net…
==============================================================================
--- branches/aicom-network-fixes/drivers/network/ndis/ndis/buffer.c [iso-8859-1]
(original)
+++ branches/aicom-network-fixes/drivers/network/ndis/ndis/buffer.c [iso-8859-1] Sun Aug
31 22:13:35 2008
@@ -488,6 +488,8 @@
"NumberOfDescriptors (%d) ProtocolReservedLength (%d).\n",
Status, PoolHandle, NumberOfDescriptors, ProtocolReservedLength));
+ *PoolHandle = NULL;
+
if (NumberOfDescriptors > 0xffff)
{
*Status = NDIS_STATUS_RESOURCES;
@@ -528,8 +530,9 @@
*Status = NDIS_STATUS_SUCCESS;
*PoolHandle = (PNDIS_HANDLE)Pool;
- } else
+ } else {
*Status = NDIS_STATUS_RESOURCES;
+ }
}
}
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] Sun Aug
31 22:13:35 2008
@@ -193,13 +193,14 @@
NDIS_DbgPrint(MAX_TRACE, ("Called\n"));
+ *ConfigurationHandle = NULL;
+
*Status = ZwDuplicateObject(NtCurrentProcess(), RootKeyHandle,
NtCurrentProcess(), &KeyHandle, 0, 0,
DUPLICATE_SAME_ACCESS);
if(!NT_SUCCESS(*Status))
{
NDIS_DbgPrint(MID_TRACE, ("Failed to open registry configuration for this
miniport\n"));
- *ConfigurationHandle = NULL;
*Status = NDIS_STATUS_FAILURE;
return;
}
@@ -743,7 +744,8 @@
if(!MiniportResource)
{
NDIS_DbgPrint(MIN_TRACE,("Insufficient resources.\n"));
- *Status = NDIS_STATUS_FAILURE;
+ ExFreePool(IntArray);
+ *Status = NDIS_STATUS_RESOURCES;
return;
}
@@ -797,6 +799,8 @@
NDIS_HANDLE RegKeyHandle;
PMINIPORT_CONFIGURATION_CONTEXT ConfigurationContext;
+ *KeyHandle = NULL;
+
*Status = ZwEnumerateKey(ConfigurationHandle, Index, KeyBasicInformation, NULL, 0,
&KeyInformationLength);
if(*Status != STATUS_BUFFER_TOO_SMALL && *Status != STATUS_BUFFER_OVERFLOW
&& *Status != STATUS_SUCCESS)
{
@@ -885,6 +889,8 @@
OBJECT_ATTRIBUTES KeyAttributes;
NDIS_HANDLE RegKeyHandle;
+ *KeyHandle = NULL;
+
InitializeObjectAttributes(&KeyAttributes, KeyName, OBJ_CASE_INSENSITIVE,
ConfigurationHandle, 0);
*Status = ZwOpenKey(&RegKeyHandle, KEY_ALL_ACCESS, &KeyAttributes);
Modified: branches/aicom-network-fixes/drivers/network/ndis/ndis/efilter.c
URL:
http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/drivers/net…
==============================================================================
--- branches/aicom-network-fixes/drivers/network/ndis/ndis/efilter.c [iso-8859-1]
(original)
+++ branches/aicom-network-fixes/drivers/network/ndis/ndis/efilter.c [iso-8859-1] Sun Aug
31 22:13:35 2008
@@ -44,6 +44,7 @@
*Filter = (PETH_FILTER)NewFilter;
return TRUE;
}
+ *Filter = NULL;
return FALSE;
}
Modified: branches/aicom-network-fixes/drivers/network/ndis/ndis/io.c
URL:
http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/drivers/net…
==============================================================================
--- branches/aicom-network-fixes/drivers/network/ndis/ndis/io.c [iso-8859-1] (original)
+++ branches/aicom-network-fixes/drivers/network/ndis/ndis/io.c [iso-8859-1] Sun Aug 31
22:13:35 2008
@@ -841,6 +841,8 @@
PNDIS_MINIPORT_BLOCK Adapter = (PNDIS_MINIPORT_BLOCK)MiniportAdapterHandle;
ULONG AddressSpace = 1; /* FIXME The HAL handles this wrong atm */
+ *PortOffset = 0;
+
NDIS_DbgPrint(MAX_TRACE, ("Called - InitialPort 0x%x, NumberOfPorts 0x%x\n",
InitialPort, NumberOfPorts));
memset(&PortAddress, 0, sizeof(PortAddress));
@@ -878,7 +880,6 @@
NDIS_DbgPrint(MAX_TRACE, ("calling MmMapIoSpace\n"));
- *PortOffset = 0;
*PortOffset = MmMapIoSpace(TranslatedAddress, NumberOfPorts, MmNonCached);
NDIS_DbgPrint(MAX_TRACE, ("Returning 0x%x for port range\n", *PortOffset));
Modified: branches/aicom-network-fixes/drivers/network/ndis/ndis/miniport.c
URL:
http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/drivers/net…
==============================================================================
--- branches/aicom-network-fixes/drivers/network/ndis/ndis/miniport.c [iso-8859-1]
(original)
+++ branches/aicom-network-fixes/drivers/network/ndis/ndis/miniport.c [iso-8859-1] Sun Aug
31 22:13:35 2008
@@ -562,13 +562,6 @@
/* FIXME: Wait in pending case! */
- /* XXX is status_pending part of success macro? */
- if ((NT_SUCCESS(NdisStatus)) || (NdisStatus == NDIS_STATUS_PENDING))
- {
- NDIS_DbgPrint(DEBUG_MINIPORT, ("Miniport returned status (0x%X).\n",
NdisStatus));
- return NdisStatus;
- }
-
return NdisStatus;
}
@@ -1017,6 +1010,7 @@
RegistryPath = ExAllocatePool(PagedPool, sizeof(UNICODE_STRING));
if(!RegistryPath)
{
+ ExFreePool(Miniport);
NDIS_DbgPrint(MIN_TRACE, ("Insufficient resources.\n"));
return;
}
@@ -1028,6 +1022,8 @@
if(!RegistryBuffer)
{
NDIS_DbgPrint(MIN_TRACE, ("Insufficient resources.\n"));
+ ExFreePool(Miniport);
+ ExFreePool(RegistryPath);
return;
}