diff options
author | Philippe Waroquiers <philippe.waroquiers@skynet.be> | 2018-12-30 20:41:49 +0100 |
---|---|---|
committer | Philippe Waroquiers <philippe.waroquiers@skynet.be> | 2018-12-31 17:28:54 +0100 |
commit | 2139e8dc9f8f11aacb3e4b697a3d554b28d50ee6 (patch) | |
tree | 84b25b7909e371fc37884f8371b7e457699fa2a3 /gdb/main.h | |
parent | 8fd04a4255376036e85c4e80d430b44ec4b06c64 (diff) | |
download | gdb-2139e8dc9f8f11aacb3e4b697a3d554b28d50ee6.zip gdb-2139e8dc9f8f11aacb3e4b697a3d554b28d50ee6.tar.gz gdb-2139e8dc9f8f11aacb3e4b697a3d554b28d50ee6.tar.bz2 |
Use gdb::unique_xmalloc_ptr<char> in command_line_input to fix a leak
Following the change of logic where the input_handler gets a
gdb::unique_xmalloc_ptr<char>, a call to readline directly
followed by a call to handle_line_of_input is missing a free,
and causes the below leak.
Use gdb::unique_xmalloc_ptr<char> to solve the leak.
==16291== VALGRIND_GDB_ERROR_BEGIN
==16291== 64 bytes in 1 blocks are definitely lost in loss record 1,815 of 4,111
==16291== at 0x4C2E2B3: realloc (vg_replace_malloc.c:836)
==16291== by 0x41EB1C: xrealloc (common-utils.c:62)
==16291== by 0x41DBD3: buffer_grow(buffer*, char const*, unsigned long) [clone .part.1] (buffer.c:40)
==16291== by 0x66E8FF: buffer_grow_char (buffer.h:40)
==16291== by 0x66E8FF: gdb_readline_no_editing (top.c:798)
==16291== by 0x66E8FF: command_line_input(char const*, char const*) (top.c:1249)
==16291== by 0x66EBD8: read_command_file(_IO_FILE*) (top.c:421)
==16291== by 0x412C0C: script_from_file(_IO_FILE*, char const*) (cli-script.c:1547)
==16291== by 0x40BE90: source_script_from_stream (cli-cmds.c:569)
==16291== by 0x40BE90: source_script_with_search(char const*, int, int) (cli-cmds.c:606)
==16291== by 0x54D567: catch_command_errors(void (*)(char const*, int), char const*, int) (main.c:379)
==16291== by 0x54EA84: captured_main_1 (main.c:994)
==16291== by 0x54EA84: captured_main (main.c:1167)
==16291== by 0x54EA84: gdb_main(captured_main_args*) (main.c:1193)
==16291== by 0x29DA27: main (gdb.c:32)
==16291==
==16291== VALGRIND_GDB_ERROR_END
gdb/ChangeLog
2018-12-31 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* top.c (command_line_input): Use unique_xmalloc_ptr to
manage memory allocated by readline.
Diffstat (limited to 'gdb/main.h')
0 files changed, 0 insertions, 0 deletions