public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Chenggang Qin <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: acme@redhat.com, mingo@redhat.com, mingo@kernel.org,
	a.p.zijlstra@chello.nl, efault@gmx.de, akpm@linux-foundation.org,
	yanmin.zhang@intel.com, dsahern@gmail.com, tglx@linutronix.de,
	fengguang.wu@intel.com, hpa@zytor.com, paulus@samba.org,
	linux-kernel@vger.kernel.org, arjan@linux.intel.com,
	namhyung@kernel.org, namhyung@gmail.com,
	chenggang.qcg@taobao.com
Subject: [tip:perf/core] perf symbols: Fix a memory leak due to symbol__delete not being used
Date: Mon, 14 Oct 2013 22:35:50 -0700	[thread overview]
Message-ID: <tip-d4f74eb89199dc7bde5579783e9188841e1271e3@git.kernel.org> (raw)
In-Reply-To: <1381451279-4109-3-git-send-email-chenggang.qin@gmail.com>

Commit-ID:  d4f74eb89199dc7bde5579783e9188841e1271e3
Gitweb:     http://git.kernel.org/tip/d4f74eb89199dc7bde5579783e9188841e1271e3
Author:     Chenggang Qin <chenggang.qcg@taobao.com>
AuthorDate: Fri, 11 Oct 2013 08:27:59 +0800
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 14 Oct 2013 12:21:20 -0300

perf symbols: Fix a memory leak due to symbol__delete not being used

In function symbols__fixup_duplicate(), while duplicated symbols are
found, only the rb_node is removed from the tree. The symbol structures
themself are ignored.  Then, these memory areas are lost.

Signed-off-by: Chenggang Qin <chenggang.qcg@taobao.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Arjan van de Ven <arjan@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Wu Fengguang <fengguang.wu@intel.com>
Cc: Yanmin Zhang <yanmin.zhang@intel.com>
Link: http://lkml.kernel.org/r/1381451279-4109-3-git-send-email-chenggang.qin@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/symbol.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index b66c1ee..c0c3696 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -160,10 +160,12 @@ again:
 
 		if (choose_best_symbol(curr, next) == SYMBOL_A) {
 			rb_erase(&next->rb_node, symbols);
+			symbol__delete(next);
 			goto again;
 		} else {
 			nd = rb_next(&curr->rb_node);
 			rb_erase(&curr->rb_node, symbols);
+			symbol__delete(curr);
 		}
 	}
 }

  reply	other threads:[~2013-10-15  5:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-11  0:27 [PATCH 1/3] perf core: Fix a mmap and munmap mismatched bug Chenggang Qin
2013-10-11  0:27 ` [PATCH 2/3] perf core: Fix a mmap & munmap mismatches bug in dso__load Chenggang Qin
2013-10-11  0:27 ` [PATCH 3/3] perf core: Fix a memory leak bug because symbol__delete is ignored Chenggang Qin
2013-10-15  5:35   ` tip-bot for Chenggang Qin [this message]
2013-10-14 14:44 ` [PATCH 1/3] perf core: Fix a mmap and munmap mismatched bug Arnaldo Carvalho de Melo
2013-10-15  5:35 ` [tip:perf/core] perf symbols: " tip-bot for Chenggang Qin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-d4f74eb89199dc7bde5579783e9188841e1271e3@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=arjan@linux.intel.com \
    --cc=chenggang.qcg@taobao.com \
    --cc=dsahern@gmail.com \
    --cc=efault@gmx.de \
    --cc=fengguang.wu@intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@gmail.com \
    --cc=namhyung@kernel.org \
    --cc=paulus@samba.org \
    --cc=tglx@linutronix.de \
    --cc=yanmin.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox