Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752307AbbKWQKw (ORCPT ); Mon, 23 Nov 2015 11:10:52 -0500 Received: from terminus.zytor.com ([198.137.202.10]:43890 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751403AbbKWQKt (ORCPT ); Mon, 23 Nov 2015 11:10:49 -0500 Date: Mon, 23 Nov 2015 08:10:29 -0800 From: tip-bot for Masami Hiramatsu Message-ID: Cc: hpa@zytor.com, adrian.hunter@intel.com, linux-kernel@vger.kernel.org, acme@redhat.com, tglx@linutronix.de, mingo@kernel.org, jolsa@redhat.com, masami.hiramatsu.pt@hitachi.com, namhyung@kernel.org, a.p.zijlstra@chello.nl Reply-To: mingo@kernel.org, a.p.zijlstra@chello.nl, masami.hiramatsu.pt@hitachi.com, namhyung@kernel.org, jolsa@redhat.com, tglx@linutronix.de, acme@redhat.com, adrian.hunter@intel.com, hpa@zytor.com, linux-kernel@vger.kernel.org In-Reply-To: <20151118064011.30709.65674.stgit@localhost.localdomain> References: <20151118064011.30709.65674.stgit@localhost.localdomain> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf probe: Fix to free temporal Dwarf_Frame Git-Commit-ID: 05c8d802fa52ef17dbcce21c38b72b4a313eb036 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2282 Lines: 60 Commit-ID: 05c8d802fa52ef17dbcce21c38b72b4a313eb036 Gitweb: http://git.kernel.org/tip/05c8d802fa52ef17dbcce21c38b72b4a313eb036 Author: Masami Hiramatsu AuthorDate: Wed, 18 Nov 2015 15:40:12 +0900 Committer: Arnaldo Carvalho de Melo CommitDate: Thu, 19 Nov 2015 13:19:17 -0300 perf probe: Fix to free temporal Dwarf_Frame Since dwarf_cfi_addrframe returns malloc'd Dwarf_Frame object, it has to be freed after it is used. Signed-off-by: Masami Hiramatsu Cc: Adrian Hunter Cc: Jiri Olsa Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/20151118064011.30709.65674.stgit@localhost.localdomain Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/probe-finder.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c index 05012bb..1cab05a 100644 --- a/tools/perf/util/probe-finder.c +++ b/tools/perf/util/probe-finder.c @@ -683,21 +683,24 @@ static int call_probe_finder(Dwarf_Die *sc_die, struct probe_finder *pf) ret = dwarf_getlocation_addr(&fb_attr, pf->addr, &pf->fb_ops, &nops, 1); if (ret <= 0 || nops == 0) { pf->fb_ops = NULL; + ret = 0; #if _ELFUTILS_PREREQ(0, 142) } else if (nops == 1 && pf->fb_ops[0].atom == DW_OP_call_frame_cfa && pf->cfi != NULL) { - Dwarf_Frame *frame; + Dwarf_Frame *frame = NULL; if (dwarf_cfi_addrframe(pf->cfi, pf->addr, &frame) != 0 || dwarf_frame_cfa(frame, &pf->fb_ops, &nops) != 0) { pr_warning("Failed to get call frame on 0x%jx\n", (uintmax_t)pf->addr); - return -ENOENT; + ret = -ENOENT; } + free(frame); #endif } /* Call finder's callback handler */ - ret = pf->callback(sc_die, pf); + if (ret >= 0) + ret = pf->callback(sc_die, pf); /* *pf->fb_ops will be cached in libdw. Don't free it. */ pf->fb_ops = NULL; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/