diff options
author | Bruno Haible <bruno@clisp.org> | 2006-09-05 11:56:40 +0000 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2006-09-05 11:56:40 +0000 |
commit | 6465ba8523b1c434164303f98aacae946827ba6c (patch) | |
tree | 912ad735d21816a4f93770ed967fd8543d18a0fc | |
parent | 14ae15c4ee20a2d1a5aee09fceefc7cf8b1ca333 (diff) | |
download | gnulib-6465ba8523b1c434164303f98aacae946827ba6c.tar.gz |
(iconv_alloc): Realloc the final result, to throw away unused memory.haible-private
-rw-r--r-- | lib/iconvme.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/iconvme.c b/lib/iconvme.c index aa12d24adc..e920e3d461 100644 --- a/lib/iconvme.c +++ b/lib/iconvme.c @@ -253,7 +253,16 @@ again2: } # 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) |