aboutsummaryrefslogtreecommitdiff
path: root/gdb/common
diff options
context:
space:
mode:
authorMarkus Metzger <markus.t.metzger@intel.com>2013-06-03 14:32:15 +0200
committerMarkus Metzger <markus.t.metzger@intel.com>2014-01-16 12:45:10 +0100
commited9edfb5d5edb1dd0b6280ae4acdd9963a12ebe6 (patch)
treed7c2c9e35fb95685b81b19c4ac7826ce6183ac48 /gdb/common
parent724c7dd8a4520d4020883b4ae3a3f2fa489acb1a (diff)
downloadgdb-ed9edfb5d5edb1dd0b6280ae4acdd9963a12ebe6.zip
gdb-ed9edfb5d5edb1dd0b6280ae4acdd9963a12ebe6.tar.gz
gdb-ed9edfb5d5edb1dd0b6280ae4acdd9963a12ebe6.tar.bz2
btrace, linux: fix memory leak when reading branch trace
When it takes more than one iteration to read the BTS trace, the trace from the previous iteration is leaked. Fix it. 2014-01-16 Markus Metzger <markus.t.metzger@intel.com> * common/linux-btrace.c (linux_read_btrace): Free trace from previous iteration.
Diffstat (limited to 'gdb/common')
-rw-r--r--gdb/common/linux-btrace.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/gdb/common/linux-btrace.c b/gdb/common/linux-btrace.c
index ef240f7..0d36ea5 100644
--- a/gdb/common/linux-btrace.c
+++ b/gdb/common/linux-btrace.c
@@ -520,6 +520,9 @@ linux_read_btrace (struct btrace_target_info *tinfo,
{
data_head = header->data_head;
+ /* Delete any leftover trace from the previous iteration. */
+ VEC_free (btrace_block_s, btrace);
+
/* If there's new trace, let's read it. */
if (data_head != tinfo->data_head)
{