perf trace: Drop addr_location refcounts

When we use machine__resolve() we grab a reference to
addr_location.thread (and in the future to other elements there) via
machine__findnew_thread(), so we must pair that with
addr_location__put(), else we'll never drop that thread when it exits
and no other remaining data structures have pointers to it. Fix it.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: https://lkml.kernel.org/n/tip-ivg9hifzeuokb1f5jxc2wob4@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent b7e8452b
...@@ -1814,12 +1814,14 @@ static int trace__resolve_callchain(struct trace *trace, struct perf_evsel *evse ...@@ -1814,12 +1814,14 @@ static int trace__resolve_callchain(struct trace *trace, struct perf_evsel *evse
int max_stack = evsel->attr.sample_max_stack ? int max_stack = evsel->attr.sample_max_stack ?
evsel->attr.sample_max_stack : evsel->attr.sample_max_stack :
trace->max_stack; trace->max_stack;
int err;
if (machine__resolve(trace->host, &al, sample) < 0 || if (machine__resolve(trace->host, &al, sample) < 0)
thread__resolve_callchain(al.thread, cursor, evsel, sample, NULL, NULL, max_stack))
return -1; return -1;
return 0; err = thread__resolve_callchain(al.thread, cursor, evsel, sample, NULL, NULL, max_stack);
addr_location__put(&al);
return err;
} }
static int trace__fprintf_callchain(struct trace *trace, struct perf_sample *sample) static int trace__fprintf_callchain(struct trace *trace, struct perf_sample *sample)
......
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