perf util: Fix memory leak of prefix_if_not_in
authorXie XiuQi <xiexiuqi@huawei.com>
Thu, 21 May 2020 13:32:17 +0000 (21:32 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 1 Oct 2020 18:40:14 +0000 (20:40 +0200)
commitba7497197ad9e665b3906d7c6963e1ed84c59747
treef04e03446dbe4cee519a12d414d88b154047132c
parentf93c17d36a670e96a5ec5a8a8fbb59912e448ac1
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>
tools/perf/util/sort.c