mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 23:25:45 +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 */
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue