4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-21 13:59:32 +08:00
Takashi Yano 5ac83ea47a newlib: Fix memory leak regarding gdtoa-based _ldtoa_r().
After the commit a4705d387f78, printf() for floating-point values
causes a memory leak. The legacy _ldtoa_r() assumed the char pointer
returned will be free'ed by Bfree(). However, gdtoa-based _ldtoa_r()
returns the pointer returned by gdtoa() which should be free'ed by
freedtoa(). Due to this issue, the caller of _ldtoa_r() fails to free
the allocated char buffer. This is the cause of the said memory leak.
https://cygwin.com/pipermail/cygwin/2023-July/254054.html

This patch makes rv_alloc()/freedtoa() allocate/free the buffer in
a compatible way with legacy _ldtoa_r().

Fixes: a4705d387f78 ("ldtoa: Import gdtoa from OpenBSD.")
Reported-by: natan_b <natan_b@libero.it>
Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2023-08-02 15:00:56 +09:00
..
2019-02-19 14:34:18 -06:00
2019-03-04 14:14:15 +01:00
2019-03-08 12:57:42 +01:00
2019-04-30 18:49:23 +02:00
2019-12-18 10:47:43 +01:00
2019-12-21 11:44:08 +01:00
2020-02-18 11:35:42 +01:00
2020-05-28 13:34:19 -04:00
2021-10-26 18:47:22 +02:00
2021-11-23 01:19:56 +09:00
2022-12-11 11:45:36 +01:00
2022-12-16 13:36:22 +00:00
2023-01-19 18:33:40 +01:00