about summary refs log tree commit diff
path: root/libio/wgenops.c
diff options
context:
space:
mode:
authorPaul Pluzhnikov <ppluzhnikov@google.com>2015-08-12 18:56:08 -0700
committerPaul Pluzhnikov <ppluzhnikov@google.com>2015-08-12 18:56:08 -0700
commit8a29509dd9aa179bfe4ef96d49d72f6816ec878f (patch)
tree3adc134bbc346804b13acf375b1dfa287225ea44 /libio/wgenops.c
parent84895dca70f972df3842fb88f7b33b5d695cc599 (diff)
downloadglibc-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.c9
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;
 }