fix linespec bug noticed by the checker
authorTom Tromey <tromey@redhat.com>
Thu, 30 May 2013 16:57:38 +0000 (16:57 +0000)
committerTom Tromey <tromey@redhat.com>
Thu, 30 May 2013 16:57:38 +0000 (16:57 +0000)
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/ChangeLog
gdb/linespec.c

index eaa47a08910798c00230eca51633e1867102fc54..4f323851a17fdb7f28c4e5c2c621701f12f36f08 100644 (file)
@@ -1,3 +1,7 @@
+2013-05-30  Tom Tromey  <tromey@redhat.com>
+
+       * linespec.c (find_linespec_symbols): Don't reassign to 'cleanup'.
+
 2013-05-30  Tom Tromey  <tromey@redhat.com>
 
        * cli/cli-script.c (setup_user_args): Don't return after error.
index 989c8d270fae8109f3d87e1c86d4fe7541756d82..61e5377bc246c4c61138bd72cf8d769603ad509a 100644 (file)
@@ -3097,7 +3097,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