aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorGary Benson <gbenson@redhat.com>2018-10-19 11:51:41 +0100
committerGary Benson <gbenson@redhat.com>2018-10-19 11:52:33 +0100
commitba543ca5afafed5bda2db52e8f424f20ff605173 (patch)
tree7c89bdf8f4ce269480adf75c0e575d5726feba94 /gdb
parentb04480b11925aff2a1d2fbca30908801fd46c7f3 (diff)
downloadgdb-ba543ca5afafed5bda2db52e8f424f20ff605173.zip
gdb-ba543ca5afafed5bda2db52e8f424f20ff605173.tar.gz
gdb-ba543ca5afafed5bda2db52e8f424f20ff605173.tar.bz2
Fix cli_interp::cli_uiout resource leak found by Coverity
This commit fixes a resource leak found by Coverity, where cli_interp's constructor creates a new cli_ui_out, but there was no corresponding destructor to free it. gdb/ChangeLog: * cli/cli-interp.c (cli_interp::~cli_interp): New function.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog4
-rw-r--r--gdb/cli/cli-interp.c6
2 files changed, 10 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index e177cf2..d32cfd0 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,7 @@
+2018-10-19 Gary Benson <gbenson@redhat.com>
+
+ * cli/cli-interp.c (cli_interp::~cli_interp): New function.
+
2018-10-18 Sergio Durigan Junior <sergiodj@redhat.com>
PR cli/23785
diff --git a/gdb/cli/cli-interp.c b/gdb/cli/cli-interp.c
index 2aa41d6..75d8093 100644
--- a/gdb/cli/cli-interp.c
+++ b/gdb/cli/cli-interp.c
@@ -44,6 +44,7 @@ class cli_interp final : public cli_interp_base
{
public:
explicit cli_interp (const char *name);
+ ~cli_interp ();
void init (bool top_level) override;
void resume () override;
@@ -62,6 +63,11 @@ cli_interp::cli_interp (const char *name)
this->cli_uiout = cli_out_new (gdb_stdout);
}
+cli_interp::~cli_interp ()
+{
+ delete cli_uiout;
+}
+
/* Suppress notification struct. */
struct cli_suppress_notification cli_suppress_notification =
{