mirror of
https://github.com/reactos/reactos.git
synced 2025-06-06 18:00:41 +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;
|
ULONG adaptOutBufLen = 0;
|
||||||
PFIXED_INFO pFixedInfo = NULL;
|
PFIXED_INFO pFixedInfo = NULL;
|
||||||
ULONG netOutBufLen = 0;
|
ULONG netOutBufLen = 0;
|
||||||
|
ULONG ret = 0;
|
||||||
|
|
||||||
/* call GetAdaptersInfo to obtain the adapter info */
|
/* 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);
|
pAdapterInfo = (IP_ADAPTER_INFO *)HeapAlloc(ProcessHeap, 0, adaptOutBufLen);
|
||||||
if (pAdapterInfo == NULL)
|
if (pAdapterInfo == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (GetAdaptersInfo(pAdapterInfo, &adaptOutBufLen) != NO_ERROR)
|
ret = GetAdaptersInfo(pAdapterInfo, &adaptOutBufLen);
|
||||||
|
if (ret != NO_ERROR)
|
||||||
{
|
{
|
||||||
DoFormatMessage(0);
|
DoFormatMessage(0);
|
||||||
HeapFree(ProcessHeap, 0, pAdapterInfo);
|
HeapFree(ProcessHeap, 0, pAdapterInfo);
|
||||||
|
@ -377,8 +380,11 @@ VOID ShowInfo(BOOL bAll)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DoFormatMessage(0);
|
if( ERROR_NO_DATA != ret )
|
||||||
return;
|
{
|
||||||
|
DoFormatMessage(0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* call GetNetworkParams to obtain the network info */
|
/* call GetNetworkParams to obtain the network info */
|
||||||
|
@ -386,17 +392,24 @@ VOID ShowInfo(BOOL bAll)
|
||||||
{
|
{
|
||||||
pFixedInfo = (FIXED_INFO *)HeapAlloc(ProcessHeap, 0, netOutBufLen);
|
pFixedInfo = (FIXED_INFO *)HeapAlloc(ProcessHeap, 0, netOutBufLen);
|
||||||
if (pFixedInfo == NULL)
|
if (pFixedInfo == NULL)
|
||||||
|
{
|
||||||
|
if (pAdapterInfo)
|
||||||
|
HeapFree(ProcessHeap, 0, pAdapterInfo);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (GetNetworkParams(pFixedInfo, &netOutBufLen) != NO_ERROR)
|
if (GetNetworkParams(pFixedInfo, &netOutBufLen) != NO_ERROR)
|
||||||
{
|
{
|
||||||
DoFormatMessage(0);
|
DoFormatMessage(0);
|
||||||
|
if (pAdapterInfo)
|
||||||
|
HeapFree(ProcessHeap, 0, pAdapterInfo);
|
||||||
HeapFree(ProcessHeap, 0, pFixedInfo);
|
HeapFree(ProcessHeap, 0, pFixedInfo);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (pAdapterInfo)
|
||||||
|
HeapFree(ProcessHeap, 0, pAdapterInfo);
|
||||||
DoFormatMessage(0);
|
DoFormatMessage(0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -413,7 +426,7 @@ VOID ShowInfo(BOOL bAll)
|
||||||
_tprintf(_T("\tIP Routing Enabled. . . . . . . . : Yes\n"));
|
_tprintf(_T("\tIP Routing Enabled. . . . . . . . : Yes\n"));
|
||||||
else
|
else
|
||||||
_tprintf(_T("\tIP Routing Enabled. . . . . . . . : No\n"));
|
_tprintf(_T("\tIP Routing Enabled. . . . . . . . : No\n"));
|
||||||
if (pAdapter->HaveWins)
|
if (pAdapter && pAdapter->HaveWins)
|
||||||
_tprintf(_T("\tWINS Proxy enabled. . . . . . . . : Yes\n"));
|
_tprintf(_T("\tWINS Proxy enabled. . . . . . . . : Yes\n"));
|
||||||
else
|
else
|
||||||
_tprintf(_T("\tWINS Proxy enabled. . . . . . . . : No\n"));
|
_tprintf(_T("\tWINS Proxy enabled. . . . . . . . : No\n"));
|
||||||
|
@ -494,7 +507,8 @@ VOID ShowInfo(BOOL bAll)
|
||||||
}
|
}
|
||||||
|
|
||||||
HeapFree(ProcessHeap, 0, pFixedInfo);
|
HeapFree(ProcessHeap, 0, pFixedInfo);
|
||||||
HeapFree(ProcessHeap, 0, pAdapterInfo);
|
if (pAdapterInfo)
|
||||||
|
HeapFree(ProcessHeap, 0, pAdapterInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID Release(LPTSTR Index)
|
VOID Release(LPTSTR Index)
|
||||||
|
|
Loading…
Reference in a new issue