Commit 0fb18553 authored by Masami Hiramatsu's avatar Masami Hiramatsu Committed by Arnaldo Carvalho de Melo

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 e607f142 ("perf probe:
Print deleted events in cmd_probe()").
Reported-by: default avatarMilian Wolff <milian.wolff@kdab.com>
Signed-off-by: default avatarMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/20150916125241.4446.44805.stgit@localhost.localdomainSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 96f3eda6
...@@ -380,8 +380,11 @@ static int perf_del_probe_events(struct strfilter *filter) ...@@ -380,8 +380,11 @@ static int perf_del_probe_events(struct strfilter *filter)
goto out; goto out;
klist = strlist__new(NULL, NULL); klist = strlist__new(NULL, NULL);
if (!klist) ulist = strlist__new(NULL, NULL);
return -ENOMEM; if (!klist || !ulist) {
ret = -ENOMEM;
goto out;
}
ret = probe_file__get_events(kfd, filter, klist); ret = probe_file__get_events(kfd, filter, klist);
if (ret == 0) { if (ret == 0) {
......
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