Unverified Commit 2b2ef2a2 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!10113 Fixed two memory leak issues of the Perf tool

Merge Pull Request from: @ci-robot 
 
PR sync from: Junhao He <hejunhao3@huawei.com>
https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/AIKNJUBQKDV2A2XNAWFU3MIX3ZZMRLOJ/ 
Fixed two memory leak issues of the Perf tool

Yicong Yang (2):
  perf parse-events: Fix one memory leakage issue
  perf stat: Fix memory leakage when trying perf on an offline CPU


-- 
2.33.0
 
https://gitee.com/openeuler/kernel/issues/I8MEWF 
 
Link:https://gitee.com/openeuler/kernel/pulls/10113

 

Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
parents f7cda317 2fb63e09
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -768,6 +768,7 @@ static int __run_perf_stat(int argc, const char **argv, int run_idx)

				switch (stat_handle_error(counter)) {
				case COUNTER_FATAL:
					affinity__cleanup(&affinity);
					return -1;
				case COUNTER_RETRY:
					goto try_again;
@@ -813,6 +814,7 @@ static int __run_perf_stat(int argc, const char **argv, int run_idx)

					switch (stat_handle_error(counter)) {
					case COUNTER_FATAL:
						affinity__cleanup(&affinity);
						return -1;
					case COUNTER_RETRY:
						goto try_again_reset;
+4 −3
Original line number Diff line number Diff line
@@ -2637,13 +2637,12 @@ void print_sdt_events(const char *subsys_glob, const char *event_glob,
	struct probe_cache *pcache;
	struct probe_cache_entry *ent;
	struct strlist *bidlist, *sdtlist;
	struct strlist_config cfg = {.dont_dupstr = true};
	struct str_node *nd, *nd2;
	char *buf, *path, *ptr = NULL;
	struct str_node *nd, *nd2;
	bool show_detail = false;
	int ret;

	sdtlist = strlist__new(NULL, &cfg);
	sdtlist = strlist__new(NULL, NULL);
	if (!sdtlist) {
		pr_debug("Failed to allocate new strlist for SDT\n");
		return;
@@ -2670,6 +2669,8 @@ void print_sdt_events(const char *subsys_glob, const char *event_glob,
					ent->pev.event, nd->s);
			if (ret > 0)
				strlist__add(sdtlist, buf);

			free(buf);
		}
		probe_cache__delete(pcache);
	}