summaryrefslogtreecommitdiff
path: root/gdb/linespec.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/linespec.c')
-rw-r--r--gdb/linespec.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/gdb/linespec.c b/gdb/linespec.c
index a538de7ab8c..630802690de 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -2835,6 +2835,18 @@ struct decode_compound_collector
/* A hash table of all symbols we found. We use this to avoid
adding any symbol more than once. */
htab_t unique_syms;
+
+ decode_compound_collector ()
+ : symbols (NULL),
+ unique_syms (NULL)
+ {
+ }
+
+ ~decode_compound_collector ()
+ {
+ if (unique_syms != NULL)
+ htab_delete (unique_syms);
+ }
};
/* A callback for iterate_over_symbols that is used by
@@ -2886,7 +2898,6 @@ lookup_prefix_sym (struct linespec_state *state, VEC (symtab_ptr) *file_symtabs,
collector.unique_syms = htab_create_alloc (1, htab_hash_pointer,
htab_eq_pointer, NULL,
xcalloc, xfree);
- cleanup = make_cleanup_htab_delete (collector.unique_syms);
for (ix = 0; VEC_iterate (symtab_ptr, file_symtabs, ix, elt); ++ix)
{
@@ -2912,7 +2923,6 @@ lookup_prefix_sym (struct linespec_state *state, VEC (symtab_ptr) *file_symtabs,
}
}
- do_cleanups (cleanup);
discard_cleanups (outer);
return collector.symbols;
}
@@ -3129,6 +3139,18 @@ struct symtab_collector
/* This is used to ensure the symtabs are unique. */
htab_t symtab_table;
+
+ symtab_collector ()
+ : symtabs (NULL),
+ symtab_table (NULL)
+ {
+ }
+
+ ~symtab_collector ()
+ {
+ if (symtab_table != NULL)
+ htab_delete (symtab_table);
+ }
};
/* Callback for iterate_over_symtabs. */
@@ -3164,7 +3186,6 @@ collect_symtabs_from_filename (const char *file,
collector.symtabs = NULL;
collector.symtab_table = htab_create (1, htab_hash_pointer, htab_eq_pointer,
NULL);
- cleanups = make_cleanup_htab_delete (collector.symtab_table);
/* Find that file's data. */
if (search_pspace == NULL)
@@ -3184,7 +3205,6 @@ collect_symtabs_from_filename (const char *file,
iterate_over_symtabs (file, add_symtabs_to_list, &collector);
}
- do_cleanups (cleanups);
return collector.symtabs;
}