diff options
author | Michael Snyder <msnyder@vmware.com> | 2011-03-07 19:44:19 +0000 |
---|---|---|
committer | Michael Snyder <msnyder@vmware.com> | 2011-03-07 19:44:19 +0000 |
commit | 69feea6fe71f6cde3dd8026a7f396eaac2f8ab2f (patch) | |
tree | f3534ccd2cff55f2e1b974eea9894f00b656fed5 /gdb/elfread.c | |
parent | e6040cbdcd2feb312855101655e6c314f8fc3d25 (diff) | |
download | gdb-69feea6fe71f6cde3dd8026a7f396eaac2f8ab2f.zip gdb-69feea6fe71f6cde3dd8026a7f396eaac2f8ab2f.tar.gz gdb-69feea6fe71f6cde3dd8026a7f396eaac2f8ab2f.tar.bz2 |
2011-03-05 Michael Snyder <msnyder@vmware.com>
* elfread.c (elf_symtab_read): Stop memory leak.
Diffstat (limited to 'gdb/elfread.c')
-rw-r--r-- | gdb/elfread.c | 3 |
1 files changed, 3 insertions, 0 deletions
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 |