From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932582AbdJXKSt (ORCPT ); Tue, 24 Oct 2017 06:18:49 -0400 Received: from terminus.zytor.com ([65.50.211.136]:44833 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751807AbdJXKSr (ORCPT ); Tue, 24 Oct 2017 06:18:47 -0400 Date: Tue, 24 Oct 2017 03:16:14 -0700 From: tip-bot for Christophe JAILLET Message-ID: Cc: hpa@zytor.com, mingo@kernel.org, peterz@infradead.org, acme@redhat.com, alexander.shishkin@linux.intel.com, christophe.jaillet@wanadoo.fr, tglx@linutronix.de, linux-kernel@vger.kernel.org Reply-To: hpa@zytor.com, mingo@kernel.org, peterz@infradead.org, christophe.jaillet@wanadoo.fr, alexander.shishkin@linux.intel.com, acme@redhat.com, tglx@linutronix.de, linux-kernel@vger.kernel.org In-Reply-To: <20170916062537.28921-1-christophe.jaillet@wanadoo.fr> References: <20170916062537.28921-1-christophe.jaillet@wanadoo.fr> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf script: Fix error handling path Git-Commit-ID: db49bc155ad9f04ea3c4e1c9ae87850610feb1ce 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 Commit-ID: db49bc155ad9f04ea3c4e1c9ae87850610feb1ce Gitweb: https://git.kernel.org/tip/db49bc155ad9f04ea3c4e1c9ae87850610feb1ce Author: Christophe JAILLET AuthorDate: Sat, 16 Sep 2017 08:25:37 +0200 Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 23 Oct 2017 16:30:53 -0300 perf script: Fix error handling path If the string passed in '--time' is invalid, or if failed to set libtraceevent function resolver, we must do some cleanup before leaving. As in the other error handling paths of this function. Signed-off-by: Christophe JAILLET Cc: Alexander Shishkin Cc: Peter Zijlstra Cc: kernel-janitors@vger.kernel.org Link: http://lkml.kernel.org/r/20170916062537.28921-1-christophe.jaillet@wanadoo.fr Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-script.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index 3e83f47..a3add2c 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c @@ -3074,7 +3074,8 @@ int cmd_script(int argc, const char **argv) machine__resolve_kernel_addr, &session->machines.host) < 0) { pr_err("%s: failed to set libtraceevent function resolver\n", __func__); - return -1; + err = -1; + goto out_delete; } if (generate_script_lang) { @@ -3134,7 +3135,8 @@ int cmd_script(int argc, const char **argv) /* needs to be parsed after looking up reference time */ if (perf_time__parse_str(&script.ptime, script.time_str) != 0) { pr_err("Invalid time string\n"); - return -EINVAL; + err = -EINVAL; + goto out_delete; } err = __cmd_script(&script);