- sym_secsize = bfd_get_section_size (si.sym_sect);
- str_secsize = bfd_get_section_size (si.str_sect);
- dyninfo_secsize = bfd_get_section_size (si.dyninfo_sect);
- got_secsize = bfd_get_section_size (si.got_sect);
- sym_secptr = xmalloc (sym_secsize);
- cleanups = make_cleanup (xfree, sym_secptr);
- str_secptr = xmalloc (str_secsize);
- make_cleanup (xfree, str_secptr);
- dyninfo_secptr = xmalloc (dyninfo_secsize);
- make_cleanup (xfree, dyninfo_secptr);
- got_secptr = xmalloc (got_secsize);
- make_cleanup (xfree, got_secptr);
-
- if (!bfd_get_section_contents (abfd, si.sym_sect, sym_secptr,
- (file_ptr) 0, sym_secsize))
- {
- do_cleanups (cleanups);
- return;
- }
- if (!bfd_get_section_contents (abfd, si.str_sect, str_secptr,
- (file_ptr) 0, str_secsize))
- {
- do_cleanups (cleanups);
- return;
- }
- if (!bfd_get_section_contents (abfd, si.dyninfo_sect, dyninfo_secptr,
- (file_ptr) 0, dyninfo_secsize))
- {
- do_cleanups (cleanups);
- return;
- }
- if (!bfd_get_section_contents (abfd, si.got_sect, got_secptr,
- (file_ptr) 0, got_secsize))
- {
- do_cleanups (cleanups);
- return;
- }
+ gdb::byte_vector sym_sec (bfd_section_size (si.sym_sect));
+ gdb::byte_vector str_sec (bfd_section_size (si.str_sect));
+ gdb::byte_vector dyninfo_sec (bfd_section_size (si.dyninfo_sect));
+ gdb::byte_vector got_sec (bfd_section_size (si.got_sect));
+
+ if (!bfd_get_section_contents (abfd, si.sym_sect, sym_sec.data (),
+ (file_ptr) 0, sym_sec.size ()))
+ return;
+ if (!bfd_get_section_contents (abfd, si.str_sect, str_sec.data (),
+ (file_ptr) 0, str_sec.size ()))
+ return;
+ if (!bfd_get_section_contents (abfd, si.dyninfo_sect, dyninfo_sec.data (),
+ (file_ptr) 0, dyninfo_sec.size ()))
+ return;
+ if (!bfd_get_section_contents (abfd, si.got_sect, got_sec.data (),
+ (file_ptr) 0, got_sec.size ()))
+ return;