aboutsummaryrefslogtreecommitdiff
path: root/gdb/mi
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-08-13 10:57:05 -0600
committerTom Tromey <tom@tromey.com>2017-09-03 13:03:04 -0600
commite91a1fa7d49482565b5f96a2ca9e51ce6327c4ae (patch)
tree26c1f69c6f5790c9ee77475e17a012873c9b9aa5 /gdb/mi
parent7ffd83d70f2792a8a538e8599959a6ed7f5b751d (diff)
downloadgdb-e91a1fa7d49482565b5f96a2ca9e51ce6327c4ae.zip
gdb-e91a1fa7d49482565b5f96a2ca9e51ce6327c4ae.tar.gz
gdb-e91a1fa7d49482565b5f96a2ca9e51ce6327c4ae.tar.bz2
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 <tom@tromey.com> * mi/mi-cmd-env.c (env_execute_cli_command): Use gdb::unique_xmalloc_ptr.
Diffstat (limited to 'gdb/mi')
-rw-r--r--gdb/mi/mi-cmd-env.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/gdb/mi/mi-cmd-env.c b/gdb/mi/mi-cmd-env.c
index bf4578c..f24f387 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<char> 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 */ );
}
}