This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 13/40] fix cleanup handling in macho_symfile_read
- From: Tom Tromey <tromey at redhat dot com>
- From: Tom Tromey <tromey at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Thu, 09 May 2013 12:51:10 -0600
- Subject: [PATCH 13/40] fix cleanup handling in macho_symfile_read
- References: <cover dot 1368124285 dot git dot tromey at redhat dot com>
macho_symfile_read leaks a cleanup by assigning to 'back_to' too late.
* machoread.c (macho_symfile_read): Assign first cleanup to
'back_to'.
---
gdb/machoread.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/gdb/machoread.c b/gdb/machoread.c
index 9877f07..d294960 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);
--
1.8.1.4