diff options
author | Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> | 2015-09-16 08:52:42 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-09-21 17:01:17 -0400 |
commit | 0fb18553478dee5b3d8dc0af4f99a5288e81142f (patch) | |
tree | 20bf723452b413dc73eaefc932b7fbb67aeca20d | |
parent | 96f3eda67fcf2598e9d2794398e0e7ab35138ea6 (diff) |
perf probe: Fix a segfault when removing uprobe events
Fix a segfault bug and a small mistake in perf probe -d.
Since the "ulist" in perf_del_probe_events is never initialized,
strlist__add(ulist, *) always causes a segfault when removing
uprobe events by perf probe -d.
Also, the "str" local variable is never released if fail to
allocate the "klist". This fixes it too.
This has been introduced by the commit e607f1426b58 ("perf probe:
Print deleted events in cmd_probe()").
Reported-by: Milian Wolff <milian.wolff@kdab.com>
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/20150916125241.4446.44805.stgit@localhost.localdomain
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/perf/builtin-probe.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c index 94385ee89dc8..f7882ae9ebc6 100644 --- a/tools/perf/builtin-probe.c +++ b/tools/perf/builtin-probe.c | |||
@@ -380,8 +380,11 @@ static int perf_del_probe_events(struct strfilter *filter) | |||
380 | goto out; | 380 | goto out; |
381 | 381 | ||
382 | klist = strlist__new(NULL, NULL); | 382 | klist = strlist__new(NULL, NULL); |
383 | if (!klist) | 383 | ulist = strlist__new(NULL, NULL); |
384 | return -ENOMEM; | 384 | if (!klist || !ulist) { |
385 | ret = -ENOMEM; | ||
386 | goto out; | ||
387 | } | ||
385 | 388 | ||
386 | ret = probe_file__get_events(kfd, filter, klist); | 389 | ret = probe_file__get_events(kfd, filter, klist); |
387 | if (ret == 0) { | 390 | if (ret == 0) { |