aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2013-05-30 17:21:51 +0000
committerTom Tromey <tromey@redhat.com>2013-05-30 17:21:51 +0000
commit0f900f54b53296119cd3386d919f52d0d6ba655e (patch)
treeb5975b23ab29d505ef458ec961020fc61fa6699f
parenta991ac289d2074310c8746ada6df5f67bdd27222 (diff)
downloadgdb-0f900f54b53296119cd3386d919f52d0d6ba655e.zip
gdb-0f900f54b53296119cd3386d919f52d0d6ba655e.tar.gz
gdb-0f900f54b53296119cd3386d919f52d0d6ba655e.tar.bz2
fix mipsread.c
Some code in mipsread.c could leak cleanups along some return paths. * mipsread.c (read_alphacoff_dynamic_symtab): Call do_cleanups along all return paths.
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/mipsread.c25
2 files changed, 25 insertions, 5 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index e3e8aa2..e2f0342 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2013-05-30 Tom Tromey <tromey@redhat.com>
+ * mipsread.c (read_alphacoff_dynamic_symtab): Call do_cleanups
+ along all return paths.
+
+2013-05-30 Tom Tromey <tromey@redhat.com>
+
* symfile.c (find_separate_debug_file): Call do_cleanups
along all return paths.
diff --git a/gdb/mipsread.c b/gdb/mipsread.c
index e9f0402..b425780 100644
--- a/gdb/mipsread.c
+++ b/gdb/mipsread.c
@@ -227,16 +227,28 @@ read_alphacoff_dynamic_symtab (struct section_offsets *section_offsets,
if (!bfd_get_section_contents (abfd, si.sym_sect, sym_secptr,
(file_ptr) 0, sym_secsize))
- return;
+ {
+ do_cleanups (cleanups);
+ return;
+ }
if (!bfd_get_section_contents (abfd, si.str_sect, str_secptr,
(file_ptr) 0, str_secsize))
- return;
+ {
+ do_cleanups (cleanups);
+ return;
+ }
if (!bfd_get_section_contents (abfd, si.dyninfo_sect, dyninfo_secptr,
(file_ptr) 0, dyninfo_secsize))
- return;
+ {
+ do_cleanups (cleanups);
+ return;
+ }
if (!bfd_get_section_contents (abfd, si.got_sect, got_secptr,
(file_ptr) 0, got_secsize))
- return;
+ {
+ do_cleanups (cleanups);
+ return;
+ }
/* Find the number of local GOT entries and the index for the
first dynamic symbol in the GOT. */
@@ -264,7 +276,10 @@ read_alphacoff_dynamic_symtab (struct section_offsets *section_offsets,
}
}
if (dt_mips_local_gotno < 0 || dt_mips_gotsym < 0)
- return;
+ {
+ do_cleanups (cleanups);
+ return;
+ }
/* Scan all dynamic symbols and enter them into the minimal symbol
table if appropriate. */