mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 14:43:02 +00:00
Fix memory leak in vfwprintf: Don't change 'mem' pointer before freeing it.
svn path=/trunk/; revision=34609
This commit is contained in:
parent
b1e617cc6f
commit
d9c376b18d
1 changed files with 3 additions and 3 deletions
|
@ -3144,18 +3144,18 @@ int CDECL vfwprintf(FILE* file, const wchar_t *format, va_list valist)
|
||||||
/* Convert each character and stop at the first invalid character. Behavior verified by tests under WinXP SP2 */
|
/* Convert each character and stop at the first invalid character. Behavior verified by tests under WinXP SP2 */
|
||||||
char chMultiByte[MB_LEN_MAX];
|
char chMultiByte[MB_LEN_MAX];
|
||||||
int nReturn;
|
int nReturn;
|
||||||
|
wchar_t *p;
|
||||||
|
|
||||||
retval = 0;
|
retval = 0;
|
||||||
|
|
||||||
while(*mem)
|
for (p = mem; *p; p++)
|
||||||
{
|
{
|
||||||
nReturn = wctomb(chMultiByte, *mem);
|
nReturn = wctomb(chMultiByte, *p);
|
||||||
|
|
||||||
if(nReturn == -1)
|
if(nReturn == -1)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
retval += fwrite(chMultiByte, 1, nReturn, file);
|
retval += fwrite(chMultiByte, 1, nReturn, file);
|
||||||
mem++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue