This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug stdio/18820] New: fmemopen may leak memory on failure
- From: "ppluzhnikov at google dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Thu, 13 Aug 2015 03:31:40 +0000
- Subject: [Bug stdio/18820] New: fmemopen may leak memory on failure
- Auto-submitted: auto-generated
https://sourceware.org/bugzilla/show_bug.cgi?id=18820
Bug ID: 18820
Summary: fmemopen may leak memory on failure
Product: glibc
Version: unspecified
Status: NEW
Severity: normal
Priority: P2
Component: stdio
Assignee: unassigned at sourceware dot org
Reporter: ppluzhnikov at google dot com
Target Milestone: ---
While fixing PR 18757, I noticed that fmemopen leaks memory via the following
path:
FILE *
__fmemopen (void *buf, size_t len, const char *mode)
{
cookie_io_functions_t iof;
fmemopen_cookie_t *c;
c = (fmemopen_cookie_t *) calloc (sizeof (fmemopen_cookie_t), 1);
...
return _IO_fopencookie (c, mode, iof);
}
If _IO_fopencookie() fails and returns NULL, we leak.
The fix for both issues was here:
https://sourceware.org/ml/libc-alpha/2015-08/msg00315.html
but it needs more work.
I might as well separate the issues.
--
You are receiving this mail because:
You are on the CC list for the bug.