Commit db49bc15 authored by Christophe JAILLET's avatar Christophe JAILLET Committed by Arnaldo Carvalho de Melo

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: default avatarChristophe 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.frSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent a1a58707
...@@ -3074,7 +3074,8 @@ int cmd_script(int argc, const char **argv) ...@@ -3074,7 +3074,8 @@ int cmd_script(int argc, const char **argv)
machine__resolve_kernel_addr, machine__resolve_kernel_addr,
&session->machines.host) < 0) { &session->machines.host) < 0) {
pr_err("%s: failed to set libtraceevent function resolver\n", __func__); pr_err("%s: failed to set libtraceevent function resolver\n", __func__);
return -1; err = -1;
goto out_delete;
} }
if (generate_script_lang) { if (generate_script_lang) {
...@@ -3134,7 +3135,8 @@ int cmd_script(int argc, const char **argv) ...@@ -3134,7 +3135,8 @@ int cmd_script(int argc, const char **argv)
/* needs to be parsed after looking up reference time */ /* needs to be parsed after looking up reference time */
if (perf_time__parse_str(&script.ptime, script.time_str) != 0) { if (perf_time__parse_str(&script.ptime, script.time_str) != 0) {
pr_err("Invalid time string\n"); pr_err("Invalid time string\n");
return -EINVAL; err = -EINVAL;
goto out_delete;
} }
err = __cmd_script(&script); err = __cmd_script(&script);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment