[PATCH] memory leak in libio/wfileops.c do_ftell_wide [BZ #17370]
Siddhesh Poyarekar
siddhesh@redhat.com
Mon Sep 15 01:19:00 GMT 2014
On Sat, Sep 13, 2014 at 03:48:11PM +1000, Allan McRae wrote:
> Do we also need to free this in the error case directly above?
Ugh, yes, thanks for catching that. Here's a patch to do that.
Tested on x86_64.
Siddhesh
[BZ #17370]
* libio/wfileops.c (do_ftell_wide): Free OUT on error path.
diff --git a/libio/wfileops.c b/libio/wfileops.c
index ebc06e8..c5ec5f7 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);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20140915/aad3feb2/attachment.sig>
More information about the Libc-alpha
mailing list