From: Tom Tromey Date: Thu, 30 May 2013 17:06:31 +0000 (+0000) Subject: fix cleanup handling in macho_symfile_read X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e42d0aa5bac43efc5556ca0e6ad18effd04de4ea;p=binutils-gdb.git fix cleanup handling in macho_symfile_read macho_symfile_read leaks a cleanup by assigning to 'back_to' too late. * machoread.c (macho_symfile_read): Assign first cleanup to 'back_to'. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index fc3829ade6f..56be9230954 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2013-05-30 Tom Tromey + + * machoread.c (macho_symfile_read): Assign first cleanup to + 'back_to'. + 2013-05-30 Tom Tromey * m32r-rom.c (m32r_load): Call do_cleanups at all returns. diff --git a/gdb/machoread.c b/gdb/machoread.c index 9877f07b4d3..d294960f63d 100644 --- a/gdb/machoread.c +++ b/gdb/machoread.c @@ -871,10 +871,10 @@ macho_symfile_read (struct objfile *objfile, int symfile_flags) struct cleanup *back_to; symbol_table = (asymbol **) xmalloc (storage_needed); - make_cleanup (xfree, symbol_table); + back_to = make_cleanup (xfree, symbol_table); init_minimal_symbol_collection (); - back_to = make_cleanup_discard_minimal_symbols (); + make_cleanup_discard_minimal_symbols (); symcount = bfd_canonicalize_symtab (objfile->obfd, symbol_table);