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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210820113132.724034-1-rickyman7@gmail.com>
Date:   Fri, 20 Aug 2021 13:31:29 +0200
From:   Riccardo Mancini <rickyman7@...il.com>
To:     Arnaldo Carvalho de Melo <acme@...nel.org>
Cc:     Ian Rogers <irogers@...gle.com>,
        Namhyung Kim <namhyung@...nel.org>,
        Riccardo Mancini <rickyman7@...il.com>,
        Adrian Hunter <adrian.hunter@...el.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Jiri Olsa <jolsa@...hat.com>, linux-perf-users@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: [PATCH] perf tests: dlfilter: free desc and long_desc in check_filter_desc

In dlfilter-test, the function check_filter_desc calls get_filter_desc
which allocates desc and long_desc.
However, these variables are never deallocated.

This patch adds the missing frees.

Cc: Adrian Hunter <adrian.hunter@...el.com>
Fixes: 9f9c9a8de2d5e96c ("perf tests: Add dlfilter test")
Signed-off-by: Riccardo Mancini <rickyman7@...il.com>
---
 tools/perf/tests/dlfilter-test.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/tools/perf/tests/dlfilter-test.c b/tools/perf/tests/dlfilter-test.c
index 7eba7955d53154e1..bc03b5df6828d6fa 100644
--- a/tools/perf/tests/dlfilter-test.c
+++ b/tools/perf/tests/dlfilter-test.c
@@ -239,15 +239,20 @@ static int get_dlfilters_path(char *buf, size_t sz)
 
 static int check_filter_desc(struct test_data *td)
 {
-	char *long_desc;
-	char *desc;
+	char *long_desc = NULL;
+	char *desc = NULL;
+	int ret;
 
 	if (get_filter_desc(td->dlfilters, "dlfilter-test-api-v0.so", &desc, &long_desc) &&
 	    long_desc && !strcmp(long_desc, "Filter used by the 'dlfilter C API' perf test") &&
 	    desc && !strcmp(desc, "dlfilter to test v0 C API"))
-		return 0;
+		ret = 0;
+	else
+		ret = -1;
 
-	return -1;
+	free(desc);
+	free(long_desc);
+	return ret;
 }
 
 static int get_ip_addr(struct test_data *td)
-- 
2.31.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ