aboutsummaryrefslogtreecommitdiff
path: root/gdb/tui
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/tui')
-rw-r--r--gdb/tui/tui-layout.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c
index abd9810..0255c39 100644
--- a/gdb/tui/tui-layout.c
+++ b/gdb/tui/tui-layout.c
@@ -409,10 +409,12 @@ tui_set_layout_by_name (const char *layout_name)
char *buf_ptr;
enum tui_layout_type new_layout = UNDEFINED_LAYOUT;
enum tui_layout_type cur_layout = tui_current_layout ();
+ struct cleanup *old_chain;
buf_ptr = (char *) xstrdup (layout_name);
for (i = 0; (i < strlen (layout_name)); i++)
buf_ptr[i] = toupper (buf_ptr[i]);
+ old_chain = make_cleanup (xfree, buf_ptr);
/* First check for ambiguous input. */
if (strlen (buf_ptr) <= 1 && *buf_ptr == 'S')
@@ -450,7 +452,7 @@ tui_set_layout_by_name (const char *layout_name)
tui_set_layout (new_layout);
}
}
- xfree (buf_ptr);
+ do_cleanups (old_chain);
}
else
status = TUI_FAILURE;