binutils-gdb/gdb/cli
Alexandra Hájková bb6203bf1d cli-script: use unique_ptr to not leak next struct
In cli/cli-script.c, process_next_line() allocates memory
which will eventually end up being assigned to the 'next'
field in struct command_line.  However, in a case
recurse_read_control_structure returns 'invalid_control'
this memory is leaked. This commit uses std::unique_ptr
as appropriate to prevent this leakage.

This issue was found by coverity scanning.

gdb/ChangeLog:

        * cli/cli-script.h (command_line_up): New unique_ptr typedef.
	* cli/cli-script.c (multi_line_command_p): Use unique_ptr
        command_line_up instead of struct command_line.
	(build_command_line): Likewise.
	(get_command_line): Update the cmd function call parameter.
	(process_next_line):  Use unique_ptr command_line_up instead
        of struct command_line.
	(recurse_read_control_structure): Change the the type of
        next to command_line_up.
	(read_command_lines_1): Change type of `next' to be
        command_line_up and update all references of `next'
        accordingly.
2021-05-20 21:03:47 +02:00
..
cli-cmds.c gdb: add cmd_list_element::is_prefix 2021-05-17 14:01:26 -04:00
cli-cmds.h Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
cli-decode.c gdb: add cmd_list_element::is_command_class_help 2021-05-17 14:01:32 -04:00
cli-decode.h gdb: add cmd_list_element::is_command_class_help 2021-05-17 14:01:32 -04:00
cli-dump.c gdb: generate the prefix name for prefix commands on demand 2021-05-12 11:19:22 +01:00
cli-interp.c gdbsupport, gdb: give names to observers 2021-04-24 19:26:41 -04:00
cli-interp.h Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
cli-logging.c gdb: generate the prefix name for prefix commands on demand 2021-05-12 11:19:22 +01:00
cli-option.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
cli-option.h Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
cli-script.c cli-script: use unique_ptr to not leak next struct 2021-05-20 21:03:47 +02:00
cli-script.h cli-script: use unique_ptr to not leak next struct 2021-05-20 21:03:47 +02:00
cli-setshow.c gdb: Pass std::strings to ui_out::field_string () where convenient 2021-05-19 13:58:41 +01:00
cli-setshow.h Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
cli-style.c gdb: generate the prefix name for prefix commands on demand 2021-05-12 11:19:22 +01:00
cli-style.h gdb: generate the prefix name for prefix commands on demand 2021-05-12 11:19:22 +01:00
cli-utils.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
cli-utils.h Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00