Browse Source

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.
gdb-7.8-branch
Markus Metzger 13 years ago
parent
commit
ed9edfb5d5
  1. 5
      gdb/ChangeLog
  2. 3
      gdb/common/linux-btrace.c

5
gdb/ChangeLog

@ -1,3 +1,8 @@
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
* common/linux-btrace.c (linux_read_btrace): Free trace from
previous iteration.
2014-01-15 Doug Evans <dje@google.com>
* dwarf2read.c (open_and_init_dwp_file): Use pulongest to print

3
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)
{

Loading…
Cancel
Save