Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1733215 > unrolled thread

[PATCH] perf script: Fix error handling path

Started byChristophe JAILLET <christophe.jaillet@wanadoo.fr>
First post2017-09-16 08:30 +0200
Last post2017-09-16 08:30 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH] perf script: Fix error handling path Christophe JAILLET <christophe.jaillet@wanadoo.fr> - 2017-09-16 08:30 +0200

#1733215 — [PATCH] perf script: Fix error handling path

FromChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Date2017-09-16 08:30 +0200
Subject[PATCH] perf script: Fix error handling path
Message-ID<uqeM1-655-3@gated-at.bofh.it>
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>
---
 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 378f76cdf923..78ffdb4cbdea 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -3004,7 +3004,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) {
@@ -3064,7 +3065,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.11.0

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web