fix mipsread.c
authorTom Tromey <tromey@redhat.com>
Thu, 30 May 2013 17:21:51 +0000 (17:21 +0000)
committerTom Tromey <tromey@redhat.com>
Thu, 30 May 2013 17:21:51 +0000 (17:21 +0000)
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.

gdb/ChangeLog
gdb/mipsread.c

index e3e8aa2c71cca44fefe0ef4632b7e32ff517ccd3..e2f0342ea255c72c46ad0e923c8c52b4f2ce8f89 100644 (file)
@@ -1,3 +1,8 @@
+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
index e9f04024587211e943773e8fe458ee3d5f4fe654..b425780bbd21957f1115e4e1b886f976b0d1ba95 100644 (file)
@@ -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.  */
This page took 0.031066 seconds and 4 git commands to generate.