diff options
author | Christophe JAILLET <christophe.jaillet@wanadoo.fr> | 2017-09-16 02:25:37 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2017-10-23 15:30:53 -0400 |
commit | db49bc155ad9f04ea3c4e1c9ae87850610feb1ce (patch) | |
tree | ad3a1e1020613fb3f34111a696b5e506a715a2a5 /tools/perf/builtin-script.c | |
parent | a1a587073ccdc6ffae414259f65d0a94cadd0a72 (diff) |
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 <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>
Diffstat (limited to 'tools/perf/builtin-script.c')
-rw-r--r-- | tools/perf/builtin-script.c | 6 |
1 files 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) | |||
3074 | machine__resolve_kernel_addr, | 3074 | machine__resolve_kernel_addr, |
3075 | &session->machines.host) < 0) { | 3075 | &session->machines.host) < 0) { |
3076 | pr_err("%s: failed to set libtraceevent function resolver\n", __func__); | 3076 | pr_err("%s: failed to set libtraceevent function resolver\n", __func__); |
3077 | return -1; | 3077 | err = -1; |
3078 | goto out_delete; | ||
3078 | } | 3079 | } |
3079 | 3080 | ||
3080 | if (generate_script_lang) { | 3081 | if (generate_script_lang) { |
@@ -3134,7 +3135,8 @@ int cmd_script(int argc, const char **argv) | |||
3134 | /* needs to be parsed after looking up reference time */ | 3135 | /* needs to be parsed after looking up reference time */ |
3135 | if (perf_time__parse_str(&script.ptime, script.time_str) != 0) { | 3136 | if (perf_time__parse_str(&script.ptime, script.time_str) != 0) { |
3136 | pr_err("Invalid time string\n"); | 3137 | pr_err("Invalid time string\n"); |
3137 | return -EINVAL; | 3138 | err = -EINVAL; |
3139 | goto out_delete; | ||
3138 | } | 3140 | } |
3139 | 3141 | ||
3140 | err = __cmd_script(&script); | 3142 | err = __cmd_script(&script); |