Commit in reactos/subsys/system/cmd on MAIN
console.c+16-41.6 -> 1.7
fixed handling of variable arguments and free memory allocated by FormatMessage(). Thanks to Michael Fritscher for spotting this bug.

reactos/subsys/system/cmd
console.c 1.6 -> 1.7
diff -u -r1.6 -r1.7
--- console.c	21 Jun 2004 18:57:22 -0000	1.6
+++ console.c	23 Jun 2004 19:32:17 -0000	1.7
@@ -1,4 +1,4 @@
-/* $Id: console.c,v 1.6 2004/06/21 18:57:22 weiden Exp $
+/* $Id: console.c,v 1.7 2004/06/23 19:32:17 weiden Exp $
  *
  *  CONSOLE.C - console input/output functions.
  *
@@ -225,17 +225,29 @@
 
 VOID ConOutFormatMessage (DWORD MessageId, ...)
 {
-	DWORD temp;
+	DWORD ret;
 	LPTSTR text;
 	va_list arg_ptr;
-	temp = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
+	
+	va_start (arg_ptr, MessageId);
+	ret = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
 	       NULL,
 	       MessageId,
 	       MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
 	       (LPTSTR) &text,
 	       0,
 	       &arg_ptr);
-	ConErrPrintf (text);	
+	
+	va_end (arg_ptr);
+	if(ret > 0)
+	{
+		ConErrPuts (text);
+		LocalFree(text);
+	}
+	else
+	{
+		ConErrPrintf (_T("Unknown error: %d\n"), MessageId);
+	}
 }
 
 VOID ConOutPrintf (LPTSTR szFormat, ...)
CVSspam 0.2.8