From: Tom Tromey Date: Sun, 13 Aug 2017 16:57:05 +0000 (-0600) Subject: Use unique_xmalloc_ptr in env_execute_cli_command X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e91a1fa7d49482565b5f96a2ca9e51ce6327c4ae;p=binutils-gdb.git Use unique_xmalloc_ptr in env_execute_cli_command Change env_execute_cli_command to use unique_xmalloc_ptr, removing a cleanup. ChangeLog 2017-09-03 Tom Tromey * mi/mi-cmd-env.c (env_execute_cli_command): Use gdb::unique_xmalloc_ptr. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 73847c56d8f..72b52f582fd 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2017-09-03 Tom Tromey + + * mi/mi-cmd-env.c (env_execute_cli_command): Use + gdb::unique_xmalloc_ptr. + 2017-09-03 Tom Tromey * thread.c (print_thread_info_1): Use string_printf. diff --git a/gdb/mi/mi-cmd-env.c b/gdb/mi/mi-cmd-env.c index bf4578cd332..f24f387b14f 100644 --- a/gdb/mi/mi-cmd-env.c +++ b/gdb/mi/mi-cmd-env.c @@ -48,17 +48,13 @@ env_execute_cli_command (const char *cmd, const char *args) { if (cmd != 0) { - struct cleanup *old_cleanups; - char *run; + gdb::unique_xmalloc_ptr run; if (args != NULL) - run = xstrprintf ("%s %s", cmd, args); + run.reset (xstrprintf ("%s %s", cmd, args)); else - run = xstrdup (cmd); - old_cleanups = make_cleanup (xfree, run); - execute_command ( /*ui */ run, 0 /*from_tty */ ); - do_cleanups (old_cleanups); - return; + run.reset (xstrdup (cmd)); + execute_command ( /*ui */ run.get (), 0 /*from_tty */ ); } }