diff options
author | Xie XiuQi <xiexiuqi@huawei.com> | 2020-05-21 21:32:17 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-10-01 20:40:14 +0200 |
commit | ba7497197ad9e665b3906d7c6963e1ed84c59747 (patch) | |
tree | f04e03446dbe4cee519a12d414d88b154047132c /tools/perf/util | |
parent | f93c17d36a670e96a5ec5a8a8fbb59912e448ac1 (diff) | |
download | linux-stable-ba7497197ad9e665b3906d7c6963e1ed84c59747.tar.gz linux-stable-ba7497197ad9e665b3906d7c6963e1ed84c59747.tar.bz2 linux-stable-ba7497197ad9e665b3906d7c6963e1ed84c59747.zip |
perf util: Fix memory leak of prefix_if_not_in
[ Upstream commit 07e9a6f538cbeecaf5c55b6f2991416f873cdcbd ]
Need to free "str" before return when asprintf() failed to avoid memory
leak.
Signed-off-by: Xie XiuQi <xiexiuqi@huawei.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Hongbo Yao <yaohongbo@huawei.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Li Bin <huawei.libin@huawei.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lore.kernel.org/lkml/20200521133218.30150-4-liwei391@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'tools/perf/util')
-rw-r--r-- | tools/perf/util/sort.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c index 031e64ce7156..013e3f510225 100644 --- a/tools/perf/util/sort.c +++ b/tools/perf/util/sort.c @@ -2532,7 +2532,7 @@ static char *prefix_if_not_in(const char *pre, char *str) return str; if (asprintf(&n, "%s,%s", pre, str) < 0) - return NULL; + n = NULL; free(str); return n; |