This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] Fix memory leak in printf_positional
- From: Paul Eggert <eggert at cs dot ucla dot edu>
- To: libc-alpha at sourceware dot org
- Cc: Paul Eggert <eggert at cs dot ucla dot edu>
- Date: Tue, 25 Aug 2015 23:41:35 -0700
- Subject: [PATCH] Fix memory leak in printf_positional
- Authentication-results: sourceware.org; auth=none
* stdio-common/vfprintf.c (printf_positional):
Free temporary data allocated via malloc.
---
ChangeLog | 4 ++++
stdio-common/vfprintf.c | 2 ++
2 files changed, 6 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 4ee7c94..bd6d027 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2015-08-25 Paul Eggert <eggert@cs.ucla.edu>
+ Fix memory leak in printf_positional
+ * stdio-common/vfprintf.c (printf_positional):
+ Free temporary data allocated via malloc.
+
Fix memory leak in _nl_load_domain
* intl/loadmsgcat.c (_nl_load_domain):
Free data after a read failure.
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
index 0592e70..9d5406a 100644
--- a/stdio-common/vfprintf.c
+++ b/stdio-common/vfprintf.c
@@ -2091,6 +2091,8 @@ printf_positional (_IO_FILE *s, const CHAR_T *format, int readonly_format,
- specs[nspecs_done].end_of_fmt);
}
all_done:
+ if (__glibc_unlikely (args_malloced != NULL))
+ free (args_malloced);
if (__glibc_unlikely (workstart != NULL))
free (workstart);
return done;
--
2.1.0