aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@redhat.com>2014-09-16 14:20:45 +0530
committerAllan McRae <allan@archlinux.org>2014-09-16 20:00:26 +1000
commit4adf2992ac7ebf6720d8d56589eb297f5215730c (patch)
treeb8837bad7b86d834a1cf448c7434c40f560bee69
parentd2c37d028d48337d00200248340de0e4a893456b (diff)
downloadtermbaud-4adf2992ac7ebf6720d8d56589eb297f5215730c.tar.gz
termbaud-4adf2992ac7ebf6720d8d56589eb297f5215730c.tar.xz
termbaud-4adf2992ac7ebf6720d8d56589eb297f5215730c.zip
Fix memory leak in error path of do_ftell_wide (BZ #17370)
(cherry picked from commit 545583d664b64ff234b99aca0d85e99c8a55808f)
-rw-r--r--ChangeLog5
-rw-r--r--libio/wfileops.c5
2 files changed, 9 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 9ebf81e651b..890c3c64a69 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-09-16 Siddhesh Poyarekar <siddhesh@redhat.com>
+
+ [BZ #17370]
+ * libio/wfileops.c (do_ftell_wide): Free OUT on error path.
+
2014-09-11 Tim Lammens <tim.lammens@gmail.com>
[BZ #17370]
diff --git a/libio/wfileops.c b/libio/wfileops.c
index ebc06e85de3..c5ec5f7a278 100644
--- a/libio/wfileops.c
+++ b/libio/wfileops.c
@@ -708,7 +708,10 @@ do_ftell_wide (_IO_FILE *fp)
sequences must be complete since they are accepted as
wchar_t; if not, then that is an error. */
if (__glibc_unlikely (status != __codecvt_ok))
- return WEOF;
+ {
+ free (out);
+ return WEOF;
+ }
offset += outstop - out;
free (out);