This removes a couple of cleanups by using unique_xmalloc_ptr instead.
These two changes are combined because the two functions are very
similar.
gdb/ChangeLog
2018-06-18 Tom Tromey <tom@tromey.com>
* solib-frv.c (frv_relocate_main_executable): Use
unique_xmalloc_ptr.
* solib-dsbt.c (dsbt_relocate_main_executable): Use
unique_xmalloc_ptr.
+2018-06-18 Tom Tromey <tom@tromey.com>
+
+ * solib-frv.c (frv_relocate_main_executable): Use
+ unique_xmalloc_ptr.
+ * solib-dsbt.c (dsbt_relocate_main_executable): Use
+ unique_xmalloc_ptr.
+
2018-06-18 Tom Tromey <tom@tromey.com>
* objfiles.h (inhibit_section_map_updates): Update.
dsbt_relocate_main_executable (void)
{
struct int_elf32_dsbt_loadmap *ldm;
- struct cleanup *old_chain;
- struct section_offsets *new_offsets;
int changed;
struct obj_section *osect;
struct dsbt_info *info = get_dsbt_info ();
info->main_executable_lm_info = new lm_info_dsbt;
info->main_executable_lm_info->map = ldm;
- new_offsets = XCNEWVEC (struct section_offsets,
- symfile_objfile->num_sections);
- old_chain = make_cleanup (xfree, new_offsets);
+ gdb::unique_xmalloc_ptr<struct section_offsets> new_offsets
+ (XCNEWVEC (struct section_offsets, symfile_objfile->num_sections));
changed = 0;
ALL_OBJFILE_OSECTIONS (symfile_objfile, osect)
}
if (changed)
- objfile_relocate (symfile_objfile, new_offsets);
-
- do_cleanups (old_chain);
+ objfile_relocate (symfile_objfile, new_offsets.get ());
/* Now that symfile_objfile has been relocated, we can compute the
GOT value and stash it away. */
int status;
CORE_ADDR exec_addr, interp_addr;
struct int_elf32_fdpic_loadmap *ldm;
- struct cleanup *old_chain;
- struct section_offsets *new_offsets;
int changed;
struct obj_section *osect;
main_executable_lm_info = new lm_info_frv;
main_executable_lm_info->map = ldm;
- new_offsets = XCNEWVEC (struct section_offsets,
- symfile_objfile->num_sections);
- old_chain = make_cleanup (xfree, new_offsets);
+ gdb::unique_xmalloc_ptr<struct section_offsets> new_offsets
+ (XCNEWVEC (struct section_offsets, symfile_objfile->num_sections));
changed = 0;
ALL_OBJFILE_OSECTIONS (symfile_objfile, osect)
}
if (changed)
- objfile_relocate (symfile_objfile, new_offsets);
-
- do_cleanups (old_chain);
+ objfile_relocate (symfile_objfile, new_offsets.get ());
/* Now that symfile_objfile has been relocated, we can compute the
GOT value and stash it away. */