mirror of
https://github.com/reactos/reactos.git
synced 2025-06-05 01:10:26 +00:00
- fix ipconfig output when no nic adapter is present, patch by Lucas Suggs, <anakha AT cat DOT pdx DOT edu>
- bug 3928 - fix a few memory leaks svn path=/trunk/; revision=37789
This commit is contained in:
parent
1de5c6737b
commit
6b053be6fe
1 changed files with 20 additions and 6 deletions
|
@ -360,15 +360,18 @@ VOID ShowInfo(BOOL bAll)
|
|||
ULONG adaptOutBufLen = 0;
|
||||
PFIXED_INFO pFixedInfo = NULL;
|
||||
ULONG netOutBufLen = 0;
|
||||
ULONG ret = 0;
|
||||
|
||||
/* call GetAdaptersInfo to obtain the adapter info */
|
||||
if (GetAdaptersInfo(pAdapterInfo, &adaptOutBufLen) == ERROR_BUFFER_OVERFLOW)
|
||||
ret = GetAdaptersInfo(pAdapterInfo, &adaptOutBufLen);
|
||||
if (ret == ERROR_BUFFER_OVERFLOW)
|
||||
{
|
||||
pAdapterInfo = (IP_ADAPTER_INFO *)HeapAlloc(ProcessHeap, 0, adaptOutBufLen);
|
||||
if (pAdapterInfo == NULL)
|
||||
return;
|
||||
|
||||
if (GetAdaptersInfo(pAdapterInfo, &adaptOutBufLen) != NO_ERROR)
|
||||
ret = GetAdaptersInfo(pAdapterInfo, &adaptOutBufLen);
|
||||
if (ret != NO_ERROR)
|
||||
{
|
||||
DoFormatMessage(0);
|
||||
HeapFree(ProcessHeap, 0, pAdapterInfo);
|
||||
|
@ -377,8 +380,11 @@ VOID ShowInfo(BOOL bAll)
|
|||
}
|
||||
else
|
||||
{
|
||||
DoFormatMessage(0);
|
||||
return;
|
||||
if( ERROR_NO_DATA != ret )
|
||||
{
|
||||
DoFormatMessage(0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* call GetNetworkParams to obtain the network info */
|
||||
|
@ -386,17 +392,24 @@ VOID ShowInfo(BOOL bAll)
|
|||
{
|
||||
pFixedInfo = (FIXED_INFO *)HeapAlloc(ProcessHeap, 0, netOutBufLen);
|
||||
if (pFixedInfo == NULL)
|
||||
{
|
||||
if (pAdapterInfo)
|
||||
HeapFree(ProcessHeap, 0, pAdapterInfo);
|
||||
return;
|
||||
|
||||
if (GetNetworkParams(pFixedInfo, &netOutBufLen) != NO_ERROR)
|
||||
{
|
||||
DoFormatMessage(0);
|
||||
if (pAdapterInfo)
|
||||
HeapFree(ProcessHeap, 0, pAdapterInfo);
|
||||
HeapFree(ProcessHeap, 0, pFixedInfo);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pAdapterInfo)
|
||||
HeapFree(ProcessHeap, 0, pAdapterInfo);
|
||||
DoFormatMessage(0);
|
||||
return;
|
||||
}
|
||||
|
@ -413,7 +426,7 @@ VOID ShowInfo(BOOL bAll)
|
|||
_tprintf(_T("\tIP Routing Enabled. . . . . . . . : Yes\n"));
|
||||
else
|
||||
_tprintf(_T("\tIP Routing Enabled. . . . . . . . : No\n"));
|
||||
if (pAdapter->HaveWins)
|
||||
if (pAdapter && pAdapter->HaveWins)
|
||||
_tprintf(_T("\tWINS Proxy enabled. . . . . . . . : Yes\n"));
|
||||
else
|
||||
_tprintf(_T("\tWINS Proxy enabled. . . . . . . . : No\n"));
|
||||
|
@ -494,7 +507,8 @@ VOID ShowInfo(BOOL bAll)
|
|||
}
|
||||
|
||||
HeapFree(ProcessHeap, 0, pFixedInfo);
|
||||
HeapFree(ProcessHeap, 0, pAdapterInfo);
|
||||
if (pAdapterInfo)
|
||||
HeapFree(ProcessHeap, 0, pAdapterInfo);
|
||||
}
|
||||
|
||||
VOID Release(LPTSTR Index)
|
||||
|
|
Loading…
Reference in a new issue