Commit 96142839 authored by Grazvydas Ignotas's avatar Grazvydas Ignotas Committed by Alexandre Julliard

msvcrt: Free old buffer properly in setvbuf.

parent ae6efdd4
...@@ -4465,7 +4465,10 @@ int CDECL MSVCRT_setvbuf(MSVCRT_FILE* file, char *buf, int mode, MSVCRT_size_t s ...@@ -4465,7 +4465,10 @@ int CDECL MSVCRT_setvbuf(MSVCRT_FILE* file, char *buf, int mode, MSVCRT_size_t s
{ {
MSVCRT__lock_file(file); MSVCRT__lock_file(file);
if(file->_bufsiz) { if(file->_bufsiz) {
if(file->_flag & MSVCRT__IOMYBUF)
MSVCRT_free(file->_base); MSVCRT_free(file->_base);
file->_flag &= ~MSVCRT__IOMYBUF;
file->_base = file->_ptr = NULL;
file->_bufsiz = 0; file->_bufsiz = 0;
file->_cnt = 0; file->_cnt = 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment