This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb] Use gdb::unique_xmalloc_ptr in auto_load_section_scripts
- From: Tom Tromey <tromey at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 9 Feb 2018 13:00:59 -0000
- Subject: [binutils-gdb] Use gdb::unique_xmalloc_ptr in auto_load_section_scripts
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=869e8290ea62f594d2472476303bb74604e9326b
commit 869e8290ea62f594d2472476303bb74604e9326b
Author: Tom Tromey <tom@tromey.com>
Date: Thu Feb 8 12:08:58 2018 -0700
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 <tom@tromey.com>
* auto-load.c (auto_load_section_scripts): Use
gdb::unique_xmalloc_ptr.
Diff:
---
gdb/ChangeLog | 5 +++++
gdb/auto-load.c | 6 ++----
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index adc3d19..9e03aa2 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
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.
2018-02-09 Joel Brobecker <brobecker@adacore.com>
diff --git a/gdb/auto-load.c b/gdb/auto-load.c
index 1f3d366..b79341f 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<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);
}
}