diff options
-rw-r--r-- | gdb/ChangeLog | 2 | ||||
-rw-r--r-- | gdb/elfread.c | 3 |
2 files changed, 5 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 85abd06..7f02c9b 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,7 @@ 2011-03-06 Michael Snyder <msnyder@vmware.com> + * elfread.c (elf_symtab_read): Stop memory leak. + * main.c (captured_main): Fix memory leak. 2011-03-07 Andreas Schwab <schwab@linux-m68k.org> diff --git a/gdb/elfread.c b/gdb/elfread.c index 59a1f7c..e638a36 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -243,6 +243,7 @@ elf_symtab_read (struct objfile *objfile, int type, char *filesymname = ""; struct dbx_symfile_info *dbx = objfile->deprecated_sym_stab_info; int stripped = (bfd_get_symcount (objfile->obfd) == 0); + struct cleanup *back_to = make_cleanup (null_cleanup, NULL); for (i = 0; i < number_of_symbols; i++) { @@ -464,6 +465,7 @@ elf_symtab_read (struct objfile *objfile, int type, + (sizeof (CORE_ADDR) * max_index)); sectinfo = (struct stab_section_info *) xmalloc (size); + make_cleanup (xfree, sectinfo); memset (sectinfo, 0, size); sectinfo->num_sections = max_index; if (filesym == NULL) @@ -572,6 +574,7 @@ elf_symtab_read (struct objfile *objfile, int type, } } } + do_cleanups (back_to); } struct build_id |