Author: pschweitzer
Date: Sat May 16 10:08:00 2015
New Revision: 67760
URL:
http://svn.reactos.org/svn/reactos?rev=67760&view=rev
Log:
[PING]
Don't mess up with the stack nor leak resources
Modified:
trunk/reactos/base/applications/network/ping/ping.c
Modified: trunk/reactos/base/applications/network/ping/ping.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/…
==============================================================================
--- trunk/reactos/base/applications/network/ping/ping.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/network/ping/ping.c [iso-8859-1] Sat May 16 10:08:00
2015
@@ -127,28 +127,34 @@
UINT DataLength;
int AnsiLength;
- va_start(valist, uID);
-
if (!LoadString(GetModuleHandle(NULL), uID,
Format, sizeof(Format) / sizeof(WCHAR)))
{
return;
}
+ va_start(valist, uID);
+
DataLength = FormatMessage(FORMAT_MESSAGE_FROM_STRING, Format, 0, 0, Buf,\
sizeof(Buf) / sizeof(WCHAR), &valist);
if(!DataLength)
{
if(GetLastError() != ERROR_INSUFFICIENT_BUFFER)
+ {
+ va_end(valist);
return;
+ }
DataLength = FormatMessage(FORMAT_MESSAGE_FROM_STRING |\
FORMAT_MESSAGE_ALLOCATE_BUFFER,\
Format, 0, 0, (LPWSTR)&pBuf, 0, &valist);
-
- if(!DataLength)
- return;
+ }
+
+ if(!DataLength)
+ {
+ va_end(valist);
+ return;
}
if(GetFileType(hStdOutput) == FILE_TYPE_CHAR)