aboutsummaryrefslogtreecommitdiff
path: root/gdb/cli
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2017-08-17 23:45:52 +0100
committerPedro Alves <palves@redhat.com>2017-08-17 23:57:45 +0100
commitb0cba12e07cc17683b13c6275f58a6a829f96d06 (patch)
tree5c82321b1a28cc899293f1f5f8b1aac191cb9803 /gdb/cli
parent4c8aa72d0eb714a91ca2e47b816d0b4a0cb27843 (diff)
downloadgdb-b0cba12e07cc17683b13c6275f58a6a829f96d06.zip
gdb-b0cba12e07cc17683b13c6275f58a6a829f96d06.tar.gz
gdb-b0cba12e07cc17683b13c6275f58a6a829f96d06.tar.bz2
Plug source_command leak
The heap-allocated 'old_source_verbose' local was accidentally left behind by commit 2ec845e75876 ("More uses of scoped_restore"). Valgrind caught it, like: ==20123== 8 bytes in 1 blocks are definitely lost in loss record 4,609 of 13,785 ==20123== at 0x4C2A988: calloc (vg_replace_malloc.c:711) ==20123== by 0x60A2F8: xcalloc (common-utils.c:84) ==20123== by 0x4CDBE5: build_command_line(command_control_type, char const*) (cli-script.c:159) ==20123== by 0x4CDC32: get_command_line(command_control_type, char const*) (cli-script.c:172) ==20123== by 0x5230F1: python_command(char*, int) (python.c:421) ==20123== by 0x4C61AD: do_cfunc(cmd_list_element*, char*, int) (cli-decode.c:106) ==20123== by 0x4C911F: cmd_func(cmd_list_element*, char*, int) (cli-decode.c:1902) ==20123== by 0x7CA79E: execute_command(char*, int) (top.c:650) ==20123== by 0x695A0C: command_handler(char*) (event-top.c:590) ==20123== by 0x7CA33F: read_command_file(_IO_FILE*) (top.c:461) ==20123== by 0x4D0C3A: script_from_file(_IO_FILE*, char const*) (cli-script.c:1584) ==20123== by 0x4C2727: source_script_from_stream(_IO_FILE*, char const*, char const*) (cli-cmds.c:589) gdb/ChangeLog: 2017-08-17 Pedro Alves <palves@redhat.com> * cli/cli-cmds.c (source_command): Delete 'old_source_verbose' local.
Diffstat (limited to 'gdb/cli')
-rw-r--r--gdb/cli/cli-cmds.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index d3ec4ae..3fa2499 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -639,7 +639,6 @@ static void
source_command (char *args, int from_tty)
{
char *file = args;
- int *old_source_verbose = XNEW (int);
int search_path = 0;
scoped_restore save_source_verbose = make_scoped_restore (&source_verbose);