aboutsummaryrefslogtreecommitdiff
path: root/gdb/tui
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@vmware.com>2007-07-05 22:47:27 +0000
committerMichael Snyder <msnyder@vmware.com>2007-07-05 22:47:27 +0000
commit2ed23f5f14b63a2a9b4afd9355c86dbb283657c0 (patch)
treeef8e245fdbb5c8d46a78f05eb2ce430e3f041e6b /gdb/tui
parent033ca630f7075c04c60f6ba5dad815ecf5a64a15 (diff)
downloadgdb-2ed23f5f14b63a2a9b4afd9355c86dbb283657c0.zip
gdb-2ed23f5f14b63a2a9b4afd9355c86dbb283657c0.tar.gz
gdb-2ed23f5f14b63a2a9b4afd9355c86dbb283657c0.tar.bz2
2007-07-05 Michael Snyder <msnyder@access-company.com>
* event-top.c (cli_command_loop): Prompt string can (and should) be freed after call to readline (Coverity). Also move local var declarations into block where they are used. * tui/tui-interp.c (tui_command_loop): Prompt string can (and should) be freed after call to readline (Coverity). Also move local var declarations into block where they are used.
Diffstat (limited to 'gdb/tui')
-rw-r--r--gdb/tui/tui-interp.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/gdb/tui/tui-interp.c b/gdb/tui/tui-interp.c
index a344754..292c7db 100644
--- a/gdb/tui/tui-interp.c
+++ b/gdb/tui/tui-interp.c
@@ -119,19 +119,20 @@ tui_exec (void *data, const char *command_str)
static void
tui_command_loop (void *data)
{
- int length;
- char *a_prompt;
- char *gdb_prompt = get_prompt ();
-
/* If we are using readline, set things up and display the first
prompt, otherwise just print the prompt. */
if (async_command_editing_p)
{
+ int length;
+ char *a_prompt;
+ char *gdb_prompt = get_prompt ();
+
/* Tell readline what the prompt to display is and what function
it will need to call after a whole line is read. This also
displays the first prompt. */
- length = strlen (PREFIX (0)) + strlen (gdb_prompt) + strlen (SUFFIX (0)) + 1;
- a_prompt = (char *) xmalloc (length);
+ length = strlen (PREFIX (0))
+ + strlen (gdb_prompt) + strlen (SUFFIX (0)) + 1;
+ a_prompt = (char *) alloca (length);
strcpy (a_prompt, PREFIX (0));
strcat (a_prompt, gdb_prompt);
strcat (a_prompt, SUFFIX (0));