aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-11-10 13:48:48 -0700
committerTom Tromey <tom@tromey.com>2018-03-18 21:50:00 -0600
commit1cb1f3dae747fef1a576fe38078891e545fa92e5 (patch)
treefccbb060b299bbdcd80132d75a372db029dc98b0 /gdb
parentc820f6a44d3b937d409c863b36f4a4c2d0333ea7 (diff)
downloadgdb-1cb1f3dae747fef1a576fe38078891e545fa92e5.zip
gdb-1cb1f3dae747fef1a576fe38078891e545fa92e5.tar.gz
gdb-1cb1f3dae747fef1a576fe38078891e545fa92e5.tar.bz2
Remove some cleanups from solib.c
This removes some cleanups from solib.c, replacing them with gdb::def_vector. Regression tested by the buildbot. gdb/ChangeLog 2018-03-18 Tom Tromey <tom@tromey.com> * solib.c (gdb_bfd_lookup_symbol_from_symtab): Use gdb::def_vector. (bfd_lookup_symbol_from_dyn_symtab): Likewise.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/solib.c10
2 files changed, 10 insertions, 6 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 4ab82d8..634a414 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2018-03-18 Tom Tromey <tom@tromey.com>
+
+ * solib.c (gdb_bfd_lookup_symbol_from_symtab): Use
+ gdb::def_vector.
+ (bfd_lookup_symbol_from_dyn_symtab): Likewise.
+
2018-03-17 Tom Tromey <tom@tromey.com>
* auto-load.c (auto_load_objfile_script_1): Use std::string.
diff --git a/gdb/solib.c b/gdb/solib.c
index f9a31bc..77c1268 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -1474,8 +1474,8 @@ gdb_bfd_lookup_symbol_from_symtab (bfd *abfd,
{
unsigned int i;
- asymbol **symbol_table = (asymbol **) xmalloc (storage_needed);
- struct cleanup *back_to = make_cleanup (xfree, symbol_table);
+ gdb::def_vector<asymbol *> storage (storage_needed / sizeof (asymbol *));
+ asymbol **symbol_table = storage.data ();
unsigned int number_of_symbols =
bfd_canonicalize_symtab (abfd, symbol_table);
@@ -1510,7 +1510,6 @@ gdb_bfd_lookup_symbol_from_symtab (bfd *abfd,
break;
}
}
- do_cleanups (back_to);
}
return symaddr;
@@ -1533,8 +1532,8 @@ bfd_lookup_symbol_from_dyn_symtab (bfd *abfd,
if (storage_needed > 0)
{
unsigned int i;
- asymbol **symbol_table = (asymbol **) xmalloc (storage_needed);
- struct cleanup *back_to = make_cleanup (xfree, symbol_table);
+ gdb::def_vector<asymbol *> storage (storage_needed / sizeof (asymbol *));
+ asymbol **symbol_table = storage.data ();
unsigned int number_of_symbols =
bfd_canonicalize_dynamic_symtab (abfd, symbol_table);
@@ -1549,7 +1548,6 @@ bfd_lookup_symbol_from_dyn_symtab (bfd *abfd,
break;
}
}
- do_cleanups (back_to);
}
return symaddr;
}