linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Peter Zijlstra <peterz@infradead.org>,
	kernel-janitors@vger.kernel.org,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 21/24] perf script: Fix error handling path
Date: Mon, 23 Oct 2017 20:47:33 -0300	[thread overview]
Message-ID: <20171023234736.5335-22-acme@kernel.org> (raw)
In-Reply-To: <20171023234736.5335-1-acme@kernel.org>

From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

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 <christophe.jaillet@wanadoo.fr>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
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 <acme@redhat.com>
---
 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 3e83f4735b21..a3add2cd7856 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);
-- 
2.13.6


  parent reply	other threads:[~2017-10-23 23:47 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-23 23:47 [GIT PULL 00/24] perf/core improvements and fixes Arnaldo Carvalho de Melo
2017-10-23 23:47 ` [PATCH 01/24] perf vendor events: Update JSON metrics for Broadwell Arnaldo Carvalho de Melo
2017-10-23 23:47 ` [PATCH 02/24] perf vendor events: Update JSON metrics for Broadwell Server Arnaldo Carvalho de Melo
2017-10-23 23:47 ` [PATCH 03/24] perf vendor events: Update JSON metrics for Haswell Arnaldo Carvalho de Melo
2017-10-23 23:47 ` [PATCH 04/24] perf vendor events: Update JSON metrics for Haswell Server Arnaldo Carvalho de Melo
2017-10-23 23:47 ` [PATCH 05/24] perf vendor events: Update JSON metrics for IvyBridge Arnaldo Carvalho de Melo
2017-10-23 23:47 ` [PATCH 06/24] perf vendor events: Update JSON metrics for IvyTown Arnaldo Carvalho de Melo
2017-10-23 23:47 ` [PATCH 07/24] perf vendor events: Update JSON metrics for JakeTown Arnaldo Carvalho de Melo
2017-10-23 23:47 ` [PATCH 08/24] perf vendor events: Update JSON metrics for Sandy Bridge Arnaldo Carvalho de Melo
2017-10-23 23:47 ` [PATCH 09/24] perf vendor events: Update JSON metrics for Skylake Arnaldo Carvalho de Melo
2017-10-23 23:47 ` [PATCH 10/24] perf vendor events: Update JSON metrics for Skylake Server Arnaldo Carvalho de Melo
2017-10-23 23:47 ` [PATCH 11/24] perf mmap: Move perf_mmap and methods to separate mmap.[ch] files Arnaldo Carvalho de Melo
2017-10-23 23:47 ` [PATCH 12/24] perf record: Make record__mmap_read generic Arnaldo Carvalho de Melo
2017-10-23 23:47 ` [PATCH 13/24] perf mmap: Adopt push method from builtin-record.c Arnaldo Carvalho de Melo
2017-10-23 23:47 ` [PATCH 14/24] perf tests attr: Make hw events optional Arnaldo Carvalho de Melo
2017-10-23 23:47 ` [PATCH 15/24] perf list: Fix group description in the man page Arnaldo Carvalho de Melo
2017-10-23 23:47 ` [PATCH 16/24] perf annotate: Remove arch::cpuid_parse callback Arnaldo Carvalho de Melo
2017-10-23 23:47 ` [PATCH 17/24] perf tools: Do not check ABI headers in a detached tarball build Arnaldo Carvalho de Melo
2017-10-23 23:47 ` [PATCH 18/24] perf vendor events: Fix incorrect cmask syntax for some Intel metrics Arnaldo Carvalho de Melo
2017-10-23 23:47 ` [PATCH 19/24] perf tools: Introduce binary__fprintf() Arnaldo Carvalho de Melo
2017-10-23 23:47 ` [PATCH 20/24] perf script: Use fprintf like printing uniformly Arnaldo Carvalho de Melo
2017-10-23 23:47 ` Arnaldo Carvalho de Melo [this message]
2017-10-23 23:47 ` [PATCH 22/24] perf kmem: Perform some cleanup if '--time' is given an invalid value Arnaldo Carvalho de Melo
2017-10-23 23:47 ` [PATCH 23/24] perf namespaces: Add more appropriate set of headers Arnaldo Carvalho de Melo
2017-10-23 23:47 ` [PATCH 24/24] perf vendor events: Add Goldmont Plus V1 event file Arnaldo Carvalho de Melo
2017-10-24  9:13 ` [GIT PULL 00/24] perf/core improvements and fixes Ingo Molnar

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=20171023234736.5335-22-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@kernel.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;
as well as URLs for NNTP newsgroup(s).