Use gdb::unique_xmalloc_ptr in auto_load_section_scripts
authorTom Tromey <tom@tromey.com>
Thu, 8 Feb 2018 19:08:58 +0000 (12:08 -0700)
committerTom Tromey <tom@tromey.com>
Fri, 9 Feb 2018 12:53:22 +0000 (05:53 -0700)
This changes auto_load_section_scripts to use gdb::unique_xmalloc_ptr,
allowing the removal of a cleanup.

2018-02-09  Tom Tromey  <tom@tromey.com>

* auto-load.c (auto_load_section_scripts): Use
gdb::unique_xmalloc_ptr.

gdb/ChangeLog
gdb/auto-load.c

index adc3d19d3b2ae4a93e87802db7315eaea5c25e83..9e03aa29080b97e6610497dfa785d36b66887fc5 100644 (file)
@@ -1,3 +1,8 @@
+2018-02-09  Tom Tromey  <tom@tromey.com>
+
+       * auto-load.c (auto_load_section_scripts): Use
+       gdb::unique_xmalloc_ptr.
+
 2018-02-09  Tom Tromey  <tom@tromey.com>
 
        * auto-load.c (execute_script_contents): Use std::string.
index 1f3d366a56373e87472cf69fb45be06d8666b20f..b79341faf6f0a554128a6ea1abfae415695b3d80 100644 (file)
@@ -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<bfd_byte> 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);
     }
 }
 
This page took 0.038689 seconds and 4 git commands to generate.