Mercurial > hg > octave-nkf > gnulib-hg
changeset 12449:eccd5d7c7a69
*printf: Fix memory leak.
author | Joel E. Denny <jdenny@clemson.edu> |
---|---|
date | Tue, 15 Dec 2009 10:07:39 +0100 |
parents | e962488c88ab |
children | 6590c835b804 |
files | ChangeLog lib/dprintf.c lib/fprintf.c lib/vdprintf.c lib/vfprintf.c |
diffstat | 5 files changed, 23 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2009-12-15 Joel E. Denny <jdenny@clemson.edu> + Bruno Haible <bruno@clisp.org> + + *printf: Fix memory leak. + * lib/fprintf.c (fprintf): Free memory allocated by vasnprintf. + * lib/vfprintf.c (vfprintf): Likewise. + * lib/dprintf.c (dprintf): Likewise. + * lib/vdprintf.c (vdprintf): Likewise. + 2009-12-14 Eric Blake <ebb9@byu.net> accept4: adjust module dependencies
--- a/lib/dprintf.c +++ b/lib/dprintf.c @@ -57,6 +57,9 @@ return -1; } + if (output != buf) + free (output); + if (len > INT_MAX) { errno = EOVERFLOW;
--- a/lib/fprintf.c +++ b/lib/fprintf.c @@ -1,5 +1,5 @@ /* Formatted output to a stream. - Copyright (C) 2004, 2006-2008 Free Software Foundation, Inc. + Copyright (C) 2004, 2006-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -63,6 +63,9 @@ return -1; } + if (output != buf) + free (output); + if (len > INT_MAX) { errno = EOVERFLOW;
--- a/lib/vdprintf.c +++ b/lib/vdprintf.c @@ -54,6 +54,9 @@ return -1; } + if (output != buf) + free (output); + if (len > INT_MAX) { errno = EOVERFLOW;
--- a/lib/vfprintf.c +++ b/lib/vfprintf.c @@ -1,5 +1,5 @@ /* Formatted output to a stream. - Copyright (C) 2004, 2006-2008 Free Software Foundation, Inc. + Copyright (C) 2004, 2006-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -60,6 +60,9 @@ return -1; } + if (output != buf) + free (output); + if (len > INT_MAX) { errno = EOVERFLOW;