summaryrefslogtreecommitdiffstats
path: root/libdwfl
diff options
context:
space:
mode:
authorMark Wielaard <mjw@redhat.com>2016-02-13 19:48:57 +0100
committerMark Wielaard <mjw@redhat.com>2016-02-22 12:14:44 +0100
commitee38add05d201eb79a36c89b92dddedbc909a1c7 (patch)
treef562c3703e0bbb5e2a055b8880cc625928c03d59 /libdwfl
parent107ad57b031e9f57f25403dfcf9fa7151deda73c (diff)
libdwfl: Don't leak memory in proc_maps_report when ENOEXEC.
We forgot to free last_file on error. Signed-off-by: Mark Wielaard <mjw@redhat.com>
Diffstat (limited to 'libdwfl')
-rw-r--r--libdwfl/ChangeLog4
-rw-r--r--libdwfl/linux-proc-maps.c3
2 files changed, 6 insertions, 1 deletions
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index 903c0cc7..69fd2337 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,5 +1,9 @@
2016-02-13 Mark Wielaard <mjw@redhat.com>
+ * linux-proc-maps.c (proc_maps_report): Free last_file when ENOEXEC.
+
+2016-02-13 Mark Wielaard <mjw@redhat.com>
+
* frame_unwind.c (new_unwound): Check and return unwound.
(handle_cfi): Check new_unwound was able to allocate new memory
before use. Return DWFL_E_NOMEM otherwise.
diff --git a/libdwfl/linux-proc-maps.c b/libdwfl/linux-proc-maps.c
index 9e7b2a21..94b26d59 100644
--- a/libdwfl/linux-proc-maps.c
+++ b/libdwfl/linux-proc-maps.c
@@ -1,5 +1,5 @@
/* Standard libdwfl callbacks for debugging a live Linux process.
- Copyright (C) 2005-2010, 2013, 2014 Red Hat, Inc.
+ Copyright (C) 2005-2010, 2013, 2014, 2016 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -218,6 +218,7 @@ proc_maps_report (Dwfl *dwfl, FILE *f, GElf_Addr sysinfo_ehdr, pid_t pid)
|| nread <= 0)
{
free (line);
+ free (last_file);
return ENOEXEC;
}