lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200521133218.30150-4-liwei391@huawei.com>
Date:   Thu, 21 May 2020 21:32:17 +0800
From:   Wei Li <liwei391@...wei.com>
To:     Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        "Arnaldo Carvalho de Melo" <acme@...nel.org>,
        Jiri Olsa <jolsa@...hat.com>,
        Mark Rutland <mark.rutland@....com>,
        Namhyung Kim <namhyung@...nel.org>
CC:     <linux-kernel@...r.kernel.org>, Li Bin <huawei.libin@...wei.com>,
        "Xie XiuQi" <xiexiuqi@...wei.com>,
        Hongbo Yao <yaohongbo@...wei.com>
Subject: [PATCH 3/4] perf util: Fix memory leak of prefix_if_not_in

From: Xie XiuQi <xiexiuqi@...wei.com>

Need to free "str" before return when asprintf() failed
to avoid memory leak.

Signed-off-by: Xie XiuQi <xiexiuqi@...wei.com>
---
 tools/perf/util/sort.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index f14cc728c358..8ed777565c82 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -2811,7 +2811,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;
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ