[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] fprintf-posix: fix memory leak
From: |
Joel E. Denny |
Subject: |
[PATCH] fprintf-posix: fix memory leak |
Date: |
Tue, 15 Dec 2009 02:51:53 -0500 (EST) |
User-agent: |
Alpine 1.00 (DEB 882 2007-12-20) |
Ok to push this? Sorry, I haven't yet explored how valgrind tests are
supposed to be added to gnulib.
>From 165ffc9aaa9bfe41a9977a80edf80e830d765ab9 Mon Sep 17 00:00:00 2001
From: Joel E. Denny <address@hidden>
Date: Tue, 15 Dec 2009 02:43:07 -0500
Subject: [PATCH] fprintf-posix: fix memory leak
* lib/fprintf.c (fprintf): Free memory allocated by vasnprintf.
---
ChangeLog | 5 +++++
lib/fprintf.c | 3 +++
2 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 2756f67..05d75db 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-12-15 Joel E. Denny <address@hidden>
+
+ fprintf-posix: fix memory leak
+ * lib/fprintf.c (fprintf): Free memory allocated by vasnprintf.
+
2009-12-14 Eric Blake <address@hidden>
accept4: adjust module dependencies
diff --git a/lib/fprintf.c b/lib/fprintf.c
index eb1cf8e..00cbb60 100644
--- a/lib/fprintf.c
+++ b/lib/fprintf.c
@@ -63,6 +63,9 @@ fprintf (FILE *fp, const char *format, ...)
return -1;
}
+ if (output != buf)
+ free (output);
+
if (len > INT_MAX)
{
errno = EOVERFLOW;
--
1.5.4.3
- [PATCH] fprintf-posix: fix memory leak,
Joel E. Denny <=