Author: jmorlan
Date: Sun Jul 20 11:48:24 2008
New Revision: 34609
URL:
http://svn.reactos.org/svn/reactos?rev=34609&view=rev
Log:
Fix memory leak in vfwprintf: Don't change 'mem' pointer before freeing it.
Modified:
trunk/reactos/lib/sdk/crt/stdio/file.c
Modified: trunk/reactos/lib/sdk/crt/stdio/file.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/stdio/file.c?r…
==============================================================================
--- trunk/reactos/lib/sdk/crt/stdio/file.c [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/stdio/file.c [iso-8859-1] Sun Jul 20 11:48:24 2008
@@ -3144,18 +3144,18 @@
/* Convert each character and stop at the first invalid character. Behavior
verified by tests under WinXP SP2 */
char chMultiByte[MB_LEN_MAX];
int nReturn;
+ wchar_t *p;
retval = 0;
- while(*mem)
+ for (p = mem; *p; p++)
{
- nReturn = wctomb(chMultiByte, *mem);
+ nReturn = wctomb(chMultiByte, *p);
if(nReturn == -1)
break;
retval += fwrite(chMultiByte, 1, nReturn, file);
- mem++;
}
}
else