msvcrt: Free old buffer properly in setvbuf.

This commit is contained in:
Grazvydas Ignotas 2014-06-14 02:23:54 +03:00 committed by Alexandre Julliard
parent ae6efdd45d
commit 9614283996
1 changed files with 4 additions and 1 deletions

View File

@ -4465,7 +4465,10 @@ int CDECL MSVCRT_setvbuf(MSVCRT_FILE* file, char *buf, int mode, MSVCRT_size_t s
{
MSVCRT__lock_file(file);
if(file->_bufsiz) {
MSVCRT_free(file->_base);
if(file->_flag & MSVCRT__IOMYBUF)
MSVCRT_free(file->_base);
file->_flag &= ~MSVCRT__IOMYBUF;
file->_base = file->_ptr = NULL;
file->_bufsiz = 0;
file->_cnt = 0;
}