* python/python.c (execute_gdb_command): Copy the argument text.

This commit is contained in:
Tom Tromey 2009-11-09 18:29:12 +00:00
parent b8b4e42bde
commit 86c6265d62
2 changed files with 9 additions and 1 deletions

View file

@ -309,7 +309,11 @@ execute_gdb_command (PyObject *self, PyObject *args)
TRY_CATCH (except, RETURN_MASK_ALL)
{
execute_command (arg, from_tty);
/* Copy the argument text in case the command modifies it. */
char *copy = xstrdup (arg);
struct cleanup *cleanup = make_cleanup (xfree, copy);
execute_command (copy, from_tty);
do_cleanups (cleanup);
}
GDB_PY_HANDLE_EXCEPTION (except);