Author: cgutman Date: Sun Aug 29 02:29:10 2010 New Revision: 48637
URL: http://svn.reactos.org/svn/reactos?rev=48637&view=rev Log: [TCPIP] - Don't allocate pool if there is nothing in the route table - Fixes bug 5493
Modified: trunk/reactos/drivers/network/tcpip/tcpip/ninfo.c
Modified: trunk/reactos/drivers/network/tcpip/tcpip/ninfo.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/tcpip... ============================================================================== --- trunk/reactos/drivers/network/tcpip/tcpip/ninfo.c [iso-8859-1] (original) +++ trunk/reactos/drivers/network/tcpip/tcpip/ninfo.c [iso-8859-1] Sun Aug 29 02:29:10 2010 @@ -21,15 +21,21 @@ KIRQL OldIrql; UINT RtCount = CountFIBs(IF); UINT Size = sizeof( IPROUTE_ENTRY ) * RtCount; - PFIB_ENTRY RCache = - ExAllocatePool( NonPagedPool, sizeof( FIB_ENTRY ) * RtCount ), - RCacheCur = RCache; - PIPROUTE_ENTRY RouteEntries = ExAllocatePool( NonPagedPool, Size ), - RtCurrent = RouteEntries; + PFIB_ENTRY RCache, RCacheCur; + PIPROUTE_ENTRY RouteEntries, RtCurrent; UINT i;
- TI_DbgPrint(DEBUG_INFO, ("Called, routes = %d, RCache = %08x\n", - RtCount, RCache)); + TI_DbgPrint(DEBUG_INFO, ("Called, routes = %d\n", + RtCount)); + + if (RtCount == 0) + return InfoCopyOut(NULL, 0, NULL, BufferSize); + + RouteEntries = ExAllocatePool( NonPagedPool, Size ); + RtCurrent = RouteEntries; + + RCache = ExAllocatePool( NonPagedPool, sizeof( FIB_ENTRY ) * RtCount ); + RCacheCur = RCache;
if( !RCache || !RouteEntries ) { if( RCache ) ExFreePool( RCache );