aboutsummaryrefslogtreecommitdiff
path: root/gdb/ChangeLog
diff options
context:
space:
mode:
authorAlexandra Hájková <ahajkova@redhat.com>2021-05-20 20:55:35 +0200
committerAlexandra Hájková <ahajkova@redhat.com>2021-05-20 21:03:47 +0200
commitbb6203bf1db908741de9355a6ae6969324e381d8 (patch)
tree23cf6d55b4b3d7f5fb5a391991e52b7b2e69a029 /gdb/ChangeLog
parent9a01ec4c0368048fb5ea1ba1b3af9afbd651b529 (diff)
downloadgdb-bb6203bf1db908741de9355a6ae6969324e381d8.zip
gdb-bb6203bf1db908741de9355a6ae6969324e381d8.tar.gz
gdb-bb6203bf1db908741de9355a6ae6969324e381d8.tar.bz2
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.
Diffstat (limited to 'gdb/ChangeLog')
-rw-r--r--gdb/ChangeLog16
1 files changed, 16 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index de0fd2d..916b17e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,4 +1,20 @@
2021-05-20 Alexandra Hájková <ahajkova@redhat.com>
+ Pedro Alves <pedro@palves.net>
+
+ * 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 Alexandra Hájková <ahajkova@redhat.com>
* MAINTAINERS (Write After Approval): Add myself.