From: Maks Mishin <maks.mishinfz@gmail.com>
To: elfutils-devel@sourceware.org
Cc: Maks Mishin <maks.mishinFZ@gmail.com>
Subject: [PATCH] segment: Fix memory leak in insert()
Date: Mon, 1 Apr 2024 20:25:13 +0300 [thread overview]
Message-ID: <20240401172513.4212-1-maks.mishinFZ@gmail.com> (raw)
Dynamic memory, referenced by 'naddr', is allocated at segment.c:66
by calling function 'realloc' and lost at segment.c:92.
Found by RASU JSC.
Signed-off-by: Maks Mishin <maks.mishinFZ@gmail.com>
---
libdwfl/segment.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libdwfl/segment.c b/libdwfl/segment.c
index f6a3e84e..5d6053e4 100644
--- a/libdwfl/segment.c
+++ b/libdwfl/segment.c
@@ -89,6 +89,8 @@ insert (Dwfl *dwfl, size_t i, GElf_Addr start, GElf_Addr end, int segndx)
return true;
}
}
+ if (naddr != NULL)
+ free(naddr);
}
if (unlikely (i < dwfl->lookup_elts))
--
2.30.2
next reply other threads:[~2024-04-01 17:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-01 17:25 Maks Mishin [this message]
2024-04-01 19:10 ` Marek Polacek
2024-04-02 20:32 Maks Mishin
2024-04-03 20:34 ` Mark Wielaard
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=20240401172513.4212-1-maks.mishinFZ@gmail.com \
--to=maks.mishinfz@gmail.com \
--cc=elfutils-devel@sourceware.org \
/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).