* [PATCH] libdwfl: Fix memory leak in proc_maps_report on bad file mapping.
@ 2016-04-14 19:34 Mark Wielaard
0 siblings, 0 replies; 2+ messages in thread
From: Mark Wielaard @ 2016-04-14 19:34 UTC (permalink / raw)
To: elfutils-devel
[-- Attachment #1: Type: text/plain, Size: 1205 bytes --]
Normally last_file is freed inside report(), but in the case of a bad
file mapping we don't call report.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
---
libdwfl/ChangeLog | 5 +++++
libdwfl/linux-proc-maps.c | 5 ++++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index 5d400bb..60ed700 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,3 +1,8 @@
+2016-04-14 Mark Wielaard <mjw@redhat.com>
+
+ * linux-proc-maps.c (proc_maps_report): Free last_file on bad file
+ mapping.
+
2016-03-01 Steven Chamberlain <steven@pyro.eu.org>
* linux-pid-attach.c: Removed unused pid_thread_callbacks,
diff --git a/libdwfl/linux-proc-maps.c b/libdwfl/linux-proc-maps.c
index 94b26d5..4ae1e74 100644
--- a/libdwfl/linux-proc-maps.c
+++ b/libdwfl/linux-proc-maps.c
@@ -250,7 +250,10 @@ proc_maps_report (Dwfl *dwfl, FILE *f, GElf_Addr sysinfo_ehdr, pid_t pid)
{
/* This is another portion of the same file's mapping. */
if (strcmp (last_file, file) != 0)
- goto bad_report;
+ {
+ free (last_file);
+ goto bad_report;
+ }
high = end;
}
else
--
2.5.5
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] libdwfl: Fix memory leak in proc_maps_report on bad file mapping.
@ 2016-04-25 11:46 Mark Wielaard
0 siblings, 0 replies; 2+ messages in thread
From: Mark Wielaard @ 2016-04-25 11:46 UTC (permalink / raw)
To: elfutils-devel
[-- Attachment #1: Type: text/plain, Size: 187 bytes --]
On Thu, 2016-04-14 at 21:34 +0200, Mark Wielaard wrote:
> Normally last_file is freed inside report(), but in the case of a bad
> file mapping we don't call report.
Pushed to master.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-04-25 11:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-14 19:34 [PATCH] libdwfl: Fix memory leak in proc_maps_report on bad file mapping Mark Wielaard
2016-04-25 11:46 Mark Wielaard
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).