Mercurial > hg > octave-lojdl > gnulib-hg
changeset 7257:6cfed75301b5 haible-private
(iconv_alloc): Realloc the final result, to throw away unused memory.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Tue, 05 Sep 2006 11:56:40 +0000 |
parents | 58ebe5a656c7 |
children | |
files | lib/iconvme.c |
diffstat | 1 files changed, 10 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/lib/iconvme.c +++ b/lib/iconvme.c @@ -253,7 +253,16 @@ } # endif - *outp = '\0'; + *outp++ = '\0'; + + /* Give away unused memory. */ + if (outp - dest < outbuf_size) + { + char *newdest = (char *) realloc (dest, outp - dest); + + if (newdest != NULL) + dest = newdest; + } out: if (have_error)