Author: cgutman
Date: Wed Oct 21 05:49:44 2009
New Revision: 43664
URL:
http://svn.reactos.org/svn/reactos?rev=43664&view=rev
Log:
- Don't allocate a buffer if we don't have any neighbors
Modified:
trunk/reactos/drivers/network/tcpip/tcpip/iinfo.c
Modified: trunk/reactos/drivers/network/tcpip/tcpip/iinfo.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/tcpi…
==============================================================================
--- trunk/reactos/drivers/network/tcpip/tcpip/iinfo.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/tcpip/tcpip/iinfo.c [iso-8859-1] Wed Oct 21 05:49:44
2009
@@ -113,16 +113,23 @@
NTSTATUS Status;
ULONG NumNeighbors = NBCopyNeighbors( Interface, NULL );
ULONG MemSize = NumNeighbors * sizeof(IPARP_ENTRY);
- PIPARP_ENTRY ArpEntries =
- exAllocatePoolWithTag
- ( NonPagedPool, MemSize, FOURCC('A','R','P','t') );
-
- if( !ArpEntries ) return STATUS_NO_MEMORY;
- NBCopyNeighbors( Interface, ArpEntries );
-
- Status = InfoCopyOut( (PVOID)ArpEntries, MemSize, Buffer, BufferSize );
-
- exFreePool( ArpEntries );
+ PIPARP_ENTRY ArpEntries;
+
+ if (MemSize != 0)
+ {
+ ArpEntries = exAllocatePoolWithTag( NonPagedPool, MemSize,
FOURCC('A','R','P','t') );
+ if( !ArpEntries ) return STATUS_NO_MEMORY;
+
+ NBCopyNeighbors( Interface, ArpEntries );
+
+ Status = InfoCopyOut( (PVOID)ArpEntries, MemSize, Buffer, BufferSize );
+
+ exFreePool( ArpEntries );
+ }
+ else
+ {
+ Status = InfoCopyOut(NULL, 0, NULL, BufferSize);
+ }
return Status;
}