+2010-12-02 Keith Seitz <keiths@redhat.com>
+
+ * linespec.c (find_method): Move name canonicalization outside
+ the loop.
+ Be paranoid and use a cleanup.
+
2010-12-01 Doug Evans <dje@google.com>
* dwarf2read.c (save_gdb_index_command): Add comment.
if (strchr (saved_arg, '(') != NULL)
{
int i;
+ char *name = saved_arg;
+ char *canon = cp_canonicalize_string (name);
+ struct cleanup *cleanup;
- for (i = 0; i < i1; ++i)
+ if (canon != NULL)
{
- char *name = saved_arg;
- char *canon = cp_canonicalize_string (name);
-
- if (canon != NULL)
- name = canon;
+ name = canon;
+ cleanup = make_cleanup (xfree, canon);
+ }
+ else
+ cleanup = make_cleanup (null_cleanup, NULL);
+ for (i = 0; i < i1; ++i)
+ {
if (strcmp_iw (name, SYMBOL_LINKAGE_NAME (sym_arr[i])) == 0)
{
values.sals = (struct symtab_and_line *)
values.nelts = 1;
values.sals[0] = find_function_start_sal (sym_arr[i],
funfirstline);
- if (canon)
- xfree (canon);
+ do_cleanups (cleanup);
return values;
}
-
- if (canon)
- xfree (canon);
}
error (_("the class `%s' does not have any method instance named %s\n"),