[D3D9][ARPING] Add missing va_start() and va_end() (#371)
authorSerge Gautherie <32623169+SergeGautherie@users.noreply.github.com>
Fri, 16 Feb 2018 09:28:25 +0000 (10:28 +0100)
committerHermès BÉLUSCA - MAÏTO <hermes.belusca-maito@reactos.org>
Fri, 16 Feb 2018 09:28:25 +0000 (10:28 +0100)
dll/directx/d3d9/d3d9_helpers.c
modules/rosapps/applications/cmdutils/arping/arping.c

index 6231f40..2747eab 100644 (file)
@@ -48,6 +48,7 @@ HRESULT SafeFormatString(OUT LPSTR Buffer, IN DWORD BufferSize, IN LPCSTR Format
 
     va_start(vargs, FormatString);
     BytesWritten = _vsnprintf(Buffer, BufferSize-1, FormatString, vargs);
+    va_end(vargs);
 
     if (BytesWritten < BufferSize)
         return DDERR_GENERIC;
index 461abbf..8836f52 100644 (file)
@@ -59,26 +59,26 @@ void FormatOutput(UINT uID, ...)
     }
 
     va_start(valist, uID);
-
     DataLength = FormatMessage(FORMAT_MESSAGE_FROM_STRING, Format, 0, 0, Buf,\
-                  sizeof(Buf) / sizeof(WCHAR), &valist);
+                               sizeof(Buf) / sizeof(WCHAR), &valist);
+    va_end(valist);
 
     if(!DataLength)
     {
         if(GetLastError() != ERROR_INSUFFICIENT_BUFFER)
         {
-            va_end(valist);
             return;
         }
 
+        va_start(valist, uID);
         DataLength = FormatMessage(FORMAT_MESSAGE_FROM_STRING |\
                                     FORMAT_MESSAGE_ALLOCATE_BUFFER,\
-                                    Format, 0, 0, (LPWSTR)&pBuf, 0, &valist);
+                                   Format, 0, 0, (LPWSTR)&pBuf, 0, &valist);
+        va_end(valist);
     }
 
     if(!DataLength)
     {
-        va_end(valist);
         return;
     }