From: Tom Tromey Date: Thu, 8 Feb 2018 19:08:58 +0000 (-0700) Subject: Use gdb::unique_xmalloc_ptr in auto_load_section_scripts X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=869e8290ea62f594d2472476303bb74604e9326b;p=binutils-gdb.git Use gdb::unique_xmalloc_ptr in auto_load_section_scripts This changes auto_load_section_scripts to use gdb::unique_xmalloc_ptr, allowing the removal of a cleanup. 2018-02-09 Tom Tromey * auto-load.c (auto_load_section_scripts): Use gdb::unique_xmalloc_ptr. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index adc3d19d3b2..9e03aa29080 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2018-02-09 Tom Tromey + + * auto-load.c (auto_load_section_scripts): Use + gdb::unique_xmalloc_ptr. + 2018-02-09 Tom Tromey * auto-load.c (execute_script_contents): Use std::string. diff --git a/gdb/auto-load.c b/gdb/auto-load.c index 1f3d366a563..b79341faf6f 100644 --- a/gdb/auto-load.c +++ b/gdb/auto-load.c @@ -1153,13 +1153,11 @@ auto_load_section_scripts (struct objfile *objfile, const char *section_name) section_name, bfd_get_filename (abfd)); else { - struct cleanup *cleanups; - char *p = (char *) data; + gdb::unique_xmalloc_ptr data_holder (data); - cleanups = make_cleanup (xfree, p); + char *p = (char *) data; source_section_scripts (objfile, section_name, p, p + bfd_get_section_size (scripts_sect)); - do_cleanups (cleanups); } }