From: Rabin Vincent <rabin@rab.in>
To: Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Paul Mackerras <paulus@samba.org>,
Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: linux-kernel@vger.kernel.org, Rabin Vincent <rabin@rab.in>
Subject: [PATCH 2/2] perf annotate: fix memory leaks in LOCK handling
Date: Sun, 18 Jan 2015 20:00:21 +0100 [thread overview]
Message-ID: <1421607621-15005-2-git-send-email-rabin@rab.in> (raw)
In-Reply-To: <1421607621-15005-1-git-send-email-rabin@rab.in>
The lock prefix handling fails to free the strdup()'d name as well as
the fields allocated by the instruction parsing.
Signed-off-by: Rabin Vincent <rabin@rab.in>
---
tools/perf/util/annotate.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 5ae428b..53d11c1 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -177,6 +177,8 @@ static int lock__parse(struct ins_operands *ops)
goto out_free_ops;
ops->locked.ins = ins__find(name);
+ free(name);
+
if (ops->locked.ins == NULL)
goto out_free_ops;
@@ -209,6 +211,13 @@ static int lock__scnprintf(struct ins *ins, char *bf, size_t size,
static void lock__delete(struct ins_operands *ops)
{
+ struct ins *ins = ops->locked.ins;
+
+ if (ins && ins->ops->free)
+ ins->ops->free(ops->locked.ops);
+ else
+ ins__delete(ops->locked.ops);
+
zfree(&ops->locked.ops);
zfree(&ops->target.raw);
zfree(&ops->target.name);
--
2.1.4
next prev parent reply other threads:[~2015-01-18 19:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-18 19:00 [PATCH 1/2] perf annotate: handle ins parsing failures Rabin Vincent
2015-01-18 19:00 ` Rabin Vincent [this message]
2015-01-28 15:01 ` [tip:perf/core] perf annotate: Fix memory leaks in LOCK handling tip-bot for Rabin Vincent
2015-01-19 15:08 ` [PATCH 1/2] perf annotate: handle ins parsing failures Arnaldo Carvalho de Melo
2015-01-28 15:00 ` [tip:perf/core] perf annotate: Handle " tip-bot for Rabin Vincent
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=1421607621-15005-2-git-send-email-rabin@rab.in \
--to=rabin@rab.in \
--cc=acme@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=paulus@samba.org \
--cc=peterz@infradead.org \
/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
all inboxes | Powered by JetHome®