mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-26 09:08:59 +00:00
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.
This commit is contained in:
@@ -186,19 +186,20 @@ rl_callback_read_char_wrapper (gdb_client_data client_data)
|
||||
void
|
||||
cli_command_loop (void)
|
||||
{
|
||||
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));
|
||||
|
||||
Reference in New Issue
Block a user