2006-04-04 Andrew Stubbs * cli/cli-script.c (struct user_args): Add command field. (arg_cleanup): Free command string. (setup_user_args): Copy the command line before relying on it. Index: src/gdb/cli/cli-script.c =================================================================== --- src.orig/gdb/cli/cli-script.c 2006-04-04 10:53:26.000000000 +0100 +++ src/gdb/cli/cli-script.c 2006-04-04 11:09:33.000000000 +0100 @@ -54,6 +54,7 @@ static int control_level; struct user_args { struct user_args *next; + char *command; struct { char *arg; @@ -483,6 +484,7 @@ arg_cleanup (void *ignore) _("arg_cleanup called with no user args.\n")); user_args = user_args->next; + xfree (oargs->command); xfree (oargs); } @@ -507,6 +509,8 @@ setup_user_args (char *p) if (p == NULL) return old_chain; + user_args->command = p = xstrdup (p); + while (*p) { char *start_arg;