]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
libdwfl: Fix memory leak in proc_maps_report on bad file mapping.
authorMark Wielaard <mjw@redhat.com>
Thu, 14 Apr 2016 19:32:55 +0000 (21:32 +0200)
committerMark Wielaard <mjw@redhat.com>
Thu, 14 Apr 2016 19:32:55 +0000 (21:32 +0200)
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
libdwfl/linux-proc-maps.c

index 5d400bb101b8ce1d9c06d3646db9e3f51558212f..60ed7009ef47ae6adca72ad654e4bbf2f190bd1d 100644 (file)
@@ -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,
index 94b26d59eb7a89a51c081cfa3a3bbe96b63373d3..4ae1e74a3ac87b4e9f47728296601a1d2cee585f 100644 (file)
@@ -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