diff options
Diffstat (limited to 'tools/perf/util/header.c')
| -rw-r--r-- | tools/perf/util/header.c | 21 | 
1 files changed, 13 insertions, 8 deletions
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index 79cce216727e..6da12e522edc 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c @@ -472,7 +472,7 @@ static int write_nrcpus(struct feat_fd *ff,  	u32 nrc, nra;  	int ret; -	nrc = cpu__max_present_cpu(); +	nrc = cpu__max_present_cpu().cpu;  	nr = sysconf(_SC_NPROCESSORS_ONLN);  	if (nr < 0) @@ -1163,7 +1163,7 @@ static int build_caches(struct cpu_cache_level caches[], u32 *cntp)  	u32 nr, cpu;  	u16 level; -	nr = cpu__max_cpu(); +	nr = cpu__max_cpu().cpu;  	for (cpu = 0; cpu < nr; cpu++) {  		for (level = 0; level < MAX_CACHE_LVL; level++) { @@ -1195,7 +1195,7 @@ static int build_caches(struct cpu_cache_level caches[], u32 *cntp)  static int write_cache(struct feat_fd *ff,  		       struct evlist *evlist __maybe_unused)  { -	u32 max_caches = cpu__max_cpu() * MAX_CACHE_LVL; +	u32 max_caches = cpu__max_cpu().cpu * MAX_CACHE_LVL;  	struct cpu_cache_level caches[max_caches];  	u32 cnt = 0, i, version = 1;  	int ret; @@ -2321,6 +2321,7 @@ out:  #define FEAT_PROCESS_STR_FUN(__feat, __feat_env) \  static int process_##__feat(struct feat_fd *ff, void *data __maybe_unused) \  {\ +	free(ff->ph->env.__feat_env);		     \  	ff->ph->env.__feat_env = do_read_string(ff); \  	return ff->ph->env.__feat_env ? 0 : -ENOMEM; \  } @@ -4124,6 +4125,7 @@ int perf_event__process_feature(struct perf_session *session,  	struct perf_record_header_feature *fe = (struct perf_record_header_feature *)event;  	int type = fe->header.type;  	u64 feat = fe->feat_id; +	int ret = 0;  	if (type < 0 || type >= PERF_RECORD_HEADER_MAX) {  		pr_warning("invalid record type %d in pipe-mode\n", type); @@ -4141,11 +4143,13 @@ int perf_event__process_feature(struct perf_session *session,  	ff.size = event->header.size - sizeof(*fe);  	ff.ph = &session->header; -	if (feat_ops[feat].process(&ff, NULL)) -		return -1; +	if (feat_ops[feat].process(&ff, NULL)) { +		ret = -1; +		goto out; +	}  	if (!feat_ops[feat].print || !tool->show_feat_hdr) -		return 0; +		goto out;  	if (!feat_ops[feat].full_only ||  	    tool->show_feat_hdr >= SHOW_FEAT_HEADER_FULL_INFO) { @@ -4154,8 +4158,9 @@ int perf_event__process_feature(struct perf_session *session,  		fprintf(stdout, "# %s info available, use -I to display\n",  			feat_ops[feat].name);  	} - -	return 0; +out: +	free_event_desc(ff.events); +	return ret;  }  size_t perf_event__fprintf_event_update(union perf_event *event, FILE *fp)  |