aboutsummaryrefslogtreecommitdiff
path: root/gdb/interps.h
diff options
context:
space:
mode:
authorGary Benson <gbenson@redhat.com>2018-10-11 10:19:26 +0100
committerGary Benson <gbenson@redhat.com>2018-10-11 10:19:26 +0100
commitfbe61a3661b083a666e6550b3b0c2de364e6d4a6 (patch)
tree081ad1be61ca54cdef6de1de3641afb91062c86a /gdb/interps.h
parenta9597defaf39e2277c4c5ff510e708f226f54fbc (diff)
downloadfsf-binutils-gdb-fbe61a3661b083a666e6550b3b0c2de364e6d4a6.zip
fsf-binutils-gdb-fbe61a3661b083a666e6550b3b0c2de364e6d4a6.tar.gz
fsf-binutils-gdb-fbe61a3661b083a666e6550b3b0c2de364e6d4a6.tar.bz2
Fix interp::m_name resource leak found by Coverity
This commit fixes a resource leak found by Coverity, where interp's constructor allocated memory for m_name that interp's destructor did not free. gdb/ChangeLog: * interps.h (interp::m_name): Make private and mutable. * interps.c (interp::~interp): Free m_name.
Diffstat (limited to 'gdb/interps.h')
-rw-r--r--gdb/interps.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/gdb/interps.h b/gdb/interps.h
index 74c9a80..dbf91f1 100644
--- a/gdb/interps.h
+++ b/gdb/interps.h
@@ -80,10 +80,12 @@ public:
}
/* This is the name in "-i=" and "set interpreter". */
- const char *m_name;
+private:
+ char *m_name;
/* Interpreters are stored in a linked list, this is the next
one... */
+public:
struct interp *next;
/* Has the init method been run? */