diff options
author | Paul Pluzhnikov <ppluzhnikov@google.com> | 2015-08-12 18:56:08 -0700 |
---|---|---|
committer | Paul Pluzhnikov <ppluzhnikov@google.com> | 2015-08-12 18:56:08 -0700 |
commit | 8a29509dd9aa179bfe4ef96d49d72f6816ec878f (patch) | |
tree | 3adc134bbc346804b13acf375b1dfa287225ea44 /libio/wgenops.c | |
parent | 84895dca70f972df3842fb88f7b33b5d695cc599 (diff) | |
download | glibc-8a29509dd9aa179bfe4ef96d49d72f6816ec878f.tar.gz glibc-8a29509dd9aa179bfe4ef96d49d72f6816ec878f.tar.xz glibc-8a29509dd9aa179bfe4ef96d49d72f6816ec878f.zip |
Fix BZ #16734 -- fopen calls mmap to allocate its buffer
Diffstat (limited to 'libio/wgenops.c')
-rw-r--r-- | libio/wgenops.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/libio/wgenops.c b/libio/wgenops.c index 69f3b95896..e7d2d1ca55 100644 --- a/libio/wgenops.c +++ b/libio/wgenops.c @@ -111,7 +111,7 @@ _IO_wsetb (f, b, eb, a) int a; { if (f->_wide_data->_IO_buf_base && !(f->_flags2 & _IO_FLAGS2_USER_WBUF)) - FREE_BUF (f->_wide_data->_IO_buf_base, _IO_wblen (f) * sizeof (wchar_t)); + free (f->_wide_data->_IO_buf_base); f->_wide_data->_IO_buf_base = b; f->_wide_data->_IO_buf_end = eb; if (a) @@ -195,8 +195,7 @@ _IO_wdefault_finish (fp, dummy) struct _IO_marker *mark; if (fp->_wide_data->_IO_buf_base && !(fp->_flags2 & _IO_FLAGS2_USER_WBUF)) { - FREE_BUF (fp->_wide_data->_IO_buf_base, - _IO_wblen (fp) * sizeof (wchar_t)); + free (fp->_wide_data->_IO_buf_base); fp->_wide_data->_IO_buf_base = fp->_wide_data->_IO_buf_end = NULL; } @@ -426,7 +425,9 @@ _IO_wdefault_doallocate (fp) { wchar_t *buf; - ALLOC_WBUF (buf, _IO_BUFSIZ, EOF); + buf = malloc (_IO_BUFSIZ); + if (__glibc_unlikely (buf == NULL)) + return EOF; _IO_wsetb (fp, buf, buf + _IO_BUFSIZ, 1); return 1; } |