Free synthsyms and member names in function elf_read_minimal_symbols.
Commit Message
The memory for synthsyms and synthsyms->name is allocated in elf64-x86-64.c
(elf_x86_64_get_synthetic_symtab). However, as shown by a valgrind memcheck,
this memory is not freed before synthsyms goes off the stack at the
termination of elf_read_minimal_symbols. This patch fixes that leak.
---
gdb/ChangeLog | 5 +++++
gdb/elfread.c | 3 +++
2 files changed, 8 insertions(+)
@@ -1,3 +1,8 @@
+2017-08-08 Alex Lindsay <alexlindsay239@gmail.com>
+
+ * elfread.c (elf_read_minimal_symbols): Free synthsyms->name and
+ synthsyms
+
2017-08-03 Tom Tromey <tom@tromey.com>
* utils.c (make_cleanup_freeargv, do_freeargv, gdb_buildargv):
@@ -1144,6 +1144,9 @@ elf_read_minimal_symbols (struct objfile *objfile, int symfile_flags,
if (symtab_create_debug)
fprintf_unfiltered (gdb_stdlog, "Done reading minimal symbols.\n");
+ if (synthcount > 0)
+ xfree ((char *) synthsyms->name);
+ xfree (synthsyms);
}
/* Scan and build partial symbols for a symbol file.