public inbox for
 help / color / mirror / Atom feed
From: Corinna Vinschen <>
To: Takashi Yano <>
Cc:, natan_b <>
Subject: Re: [PATCH v2] newlib: Fix memory leak regarding gdtoa-based _ldtoa_r().
Date: Wed, 2 Aug 2023 12:56:47 +0200	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

Hi Takashi,

On Aug  2 15:37, Takashi Yano wrote:
> 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.
> 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 <>
> Reviewed-by: Corinna Vinschen <>
> Signed-off-by: Takashi Yano <>
> ---
>  newlib/libc/stdlib/gdtoa-dmisc.c | 23 +++++++++++++----------
>  newlib/libc/stdlib/gdtoa-ldtoa.c |  4 +---
>  winsup/cygwin/release/3.4.8      |  3 +++
>  3 files changed, 17 insertions(+), 13 deletions(-)

looks good to me, please push.


      reply	other threads:[~2023-08-02 10:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-02  6:37 Takashi Yano
2023-08-02 10:56 ` Corinna Vinschen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).