From: Mark Wielaard <mark@klomp.org>
To: Maks Mishin <maks.mishinfz@gmail.com>
Cc: elfutils-devel@sourceware.org, Marek Polacek <polacek@redhat.com>
Subject: Re: [PATCH] segment: Fix memory leak in insert()
Date: Wed, 3 Apr 2024 22:34:19 +0200 [thread overview]
Message-ID: <20240403203419.GG19937@gnu.wildebeest.org> (raw)
In-Reply-To: <20240402203250.11772-1-maks.mishinFZ@gmail.com>
On Tue, Apr 02, 2024 at 11:32:50PM +0300, Maks Mishin wrote:
> Dynamic memory, referenced by 'naddr', is allocated at segment.c:66
> by calling function 'realloc' and lost at segment.c:92.
It isn't lost, it is assigned to dwfl->lookup_addr at segment.c:77
>
> Found by RASU JSC.
>
> Signed-off-by: Maks Mishin <maks.mishinFZ@gmail.com>
> ---
> libdwfl/segment.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/libdwfl/segment.c b/libdwfl/segment.c
> index f6a3e84e..618c14e6 100644
> --- a/libdwfl/segment.c
> +++ b/libdwfl/segment.c
> @@ -89,6 +89,7 @@ insert (Dwfl *dwfl, size_t i, GElf_Addr start, GElf_Addr end, int segndx)
> return true;
> }
> }
> + free (naddr);
> }
>
> if (unlikely (i < dwfl->lookup_elts))
> --
> 2.30.2
>
next prev parent reply other threads:[~2024-04-03 20:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-02 20:32 Maks Mishin
2024-04-03 20:34 ` Mark Wielaard [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-04-01 17:25 Maks Mishin
2024-04-01 19:10 ` Marek Polacek
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:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240403203419.GG19937@gnu.wildebeest.org \
--to=mark@klomp.org \
--cc=elfutils-devel@sourceware.org \
--cc=maks.mishinfz@gmail.com \
--cc=polacek@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* 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).