diff options
author | Mark Brown <broonie@kernel.org> | 2017-01-10 16:39:52 +0000 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2017-01-10 16:39:52 +0000 |
commit | 9c1852b459f04f6309e40d1d167512b0a5598529 (patch) | |
tree | a74526f1fe3f9826b81327f0b9ba9b98a543f87c /tools/perf/util/trace-event-scripting.c | |
parent | 9b41da80e09128574f09bed8dc5a5fc6f72a8239 (diff) | |
parent | 7ce7d89f48834cefece7804d38fc5d85382edf77 (diff) | |
download | linux-9c1852b459f04f6309e40d1d167512b0a5598529.tar.bz2 |
Merge tag 'v4.10-rc1' into asoc-samsung
Linux 4.10-rc1
Diffstat (limited to 'tools/perf/util/trace-event-scripting.c')
-rw-r--r-- | tools/perf/util/trace-event-scripting.c | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/tools/perf/util/trace-event-scripting.c b/tools/perf/util/trace-event-scripting.c index 9df61059a85d..0ac9077f62a2 100644 --- a/tools/perf/util/trace-event-scripting.c +++ b/tools/perf/util/trace-event-scripting.c @@ -25,6 +25,7 @@ #include <errno.h> #include "../perf.h" +#include "debug.h" #include "util.h" #include "trace-event.h" @@ -86,16 +87,15 @@ struct scripting_ops python_scripting_unsupported_ops = { static void register_python_scripting(struct scripting_ops *scripting_ops) { - int err; - err = script_spec_register("Python", scripting_ops); - if (err) - die("error registering Python script extension"); - - err = script_spec_register("py", scripting_ops); - if (err) - die("error registering py script extension"); - - scripting_context = malloc(sizeof(struct scripting_context)); + if (scripting_context == NULL) + scripting_context = malloc(sizeof(*scripting_context)); + + if (scripting_context == NULL || + script_spec_register("Python", scripting_ops) || + script_spec_register("py", scripting_ops)) { + pr_err("Error registering Python script extension: disabling it\n"); + zfree(&scripting_context); + } } #ifdef NO_LIBPYTHON @@ -150,16 +150,15 @@ struct scripting_ops perl_scripting_unsupported_ops = { static void register_perl_scripting(struct scripting_ops *scripting_ops) { - int err; - err = script_spec_register("Perl", scripting_ops); - if (err) - die("error registering Perl script extension"); - - err = script_spec_register("pl", scripting_ops); - if (err) - die("error registering pl script extension"); - - scripting_context = malloc(sizeof(struct scripting_context)); + if (scripting_context == NULL) + scripting_context = malloc(sizeof(*scripting_context)); + + if (scripting_context == NULL || + script_spec_register("Perl", scripting_ops) || + script_spec_register("pl", scripting_ops)) { + pr_err("Error registering Perl script extension: disabling it\n"); + zfree(&scripting_context); + } } #ifdef NO_LIBPERL |