estream: Fix unclean usage of realloc.
authorWerner Koch <wk@gnupg.org>
Fri, 20 Jan 2012 13:27:36 +0000 (14:27 +0100)
committerWerner Koch <wk@gnupg.org>
Fri, 20 Jan 2012 13:27:36 +0000 (14:27 +0100)
commite97e2ced6cf3ee295a3cc9f8968969a1910380ea
treea93dc002b07e86f218886d3a08f06ecece0f09c6
parent7589e43b21c8d80c5a57ecb6eb78dfcd0b5dac46
estream: Fix unclean usage of realloc.

* common/estream-printf.c (_ESTREAM_PRINTF_MALLOC): Remove.
(_ESTREAM_PRINTF_FREE): Remove.
(_ESTREAM_PRINTF_REALLOC): New.
(fixed_realloc) [!_ESTREAM_PRINTF_REALLOC]): New.
(estream_vasprintf): Use my_printf_realloc instead of my_printf_malloc
and my_printf_free.
(dynamic_buffer_out): Use my_printf_realloc instead of realloc.
--

This bug will never happen in current GnuPG/Libgcrypt because we use
the standard memory allocation functions via Libgcrypt.  However, when
used in other environments it would mess up the heap for an asprintf
with an output length larger than ~512 bytes.
common/estream-printf.c
common/estream-printf.h
common/xasprintf.c
configure.ac