[PATCH 07/40] fix linespec bug noticed by the checker

Tom Tromey
2013-05-09T19:45:50Z

This fixes a linespec bug noticed by the cleanup checker.

find_linespec_symbols did this:

cleanup = demangle_for_lookup (name, state->language->la_language,
&lookup_name);
[...]
cleanup = make_cleanup (xfree, canon);

But this is wrong, as it makes a subsequent call to do_cleanups not
clean up all the local state.

* linespec.c (find_linespec_symbols): Don't reassign to 'cleanup'.
---
gdb/linespec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/linespec.c b/gdb/linespec.c
index 1c7a7a0..4bbd6e4 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -3093,7 +3093,7 @@ find_linespec_symbols (struct linespec_state *state,
if (canon != NULL)
{
lookup_name = canon;
- cleanup = make_cleanup (xfree, canon);
+ make_cleanup (xfree, canon);
}

/* It's important to not call expand_symtabs_matching unnecessarily
--
1.8.1.4