From patchwork Wed Nov 11 10:19:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Nan X-Patchwork-Id: 56375 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp1275718lbb; Wed, 11 Nov 2015 02:20:30 -0800 (PST) X-Received: by 10.68.96.226 with SMTP id dv2mr13023635pbb.127.1447237229968; Wed, 11 Nov 2015 02:20:29 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z4si11860607par.49.2015.11.11.02.20.28; Wed, 11 Nov 2015 02:20:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752546AbbKKKUY (ORCPT + 28 others); Wed, 11 Nov 2015 05:20:24 -0500 Received: from szxga02-in.huawei.com ([119.145.14.65]:27036 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752461AbbKKKUU (ORCPT ); Wed, 11 Nov 2015 05:20:20 -0500 Received: from 172.24.1.47 (EHLO szxeml422-hub.china.huawei.com) ([172.24.1.47]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id CWD04496; Wed, 11 Nov 2015 18:19:57 +0800 (CST) Received: from linux-4hy3.site (10.107.193.248) by szxeml422-hub.china.huawei.com (10.82.67.152) with Microsoft SMTP Server id 14.3.235.1; Wed, 11 Nov 2015 18:19:51 +0800 From: Wang Nan To: CC: , , , Wang Nan , Masami Hiramatsu , Arnaldo Carvalho de Melo Subject: [PATCH] perf probe: Clear probe_trace_event when probe_trace_event failure Date: Wed, 11 Nov 2015 10:19:43 +0000 Message-ID: <1447237183-106610-1-git-send-email-wangnan0@huawei.com> X-Mailer: git-send-email 1.8.3.4 MIME-Version: 1.0 X-Originating-IP: [10.107.193.248] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090201.5643164E.0068,ss=1,re=0.000,fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2011-05-27 18:58:46 X-Mirapoint-Loop-Id: 33e40be577239ba40291004a1887c0d6 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When failure occures in add_probe_trace_event(), to avoid potential dangling pointer and memory leak, resource attached to 'struct probe_trace_event' should be cleared. Signed-off-by: Wang Nan Cc: Masami Hiramatsu Cc: Arnaldo Carvalho de Melo Cc: Zefan Li Cc: pi3orama@163.com --- tools/perf/util/probe-finder.c | 2 ++ 1 file changed, 2 insertions(+) -- 1.8.3.4 -- 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/ diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c index bd8f03d..e9e37ca 100644 --- a/tools/perf/util/probe-finder.c +++ b/tools/perf/util/probe-finder.c @@ -1235,6 +1235,8 @@ static int add_probe_trace_event(Dwarf_Die *sc_die, struct probe_finder *pf) end: free(args); + if (ret) + clear_probe_trace_event(tev); return ret; }