diff options
author | Riccardo Mancini | 2021-08-20 13:31:29 +0200 |
---|---|---|
committer | Arnaldo Carvalho de Melo | 2021-08-20 11:16:27 -0300 |
commit | 6ca822e57638783e0fff4273153b97d72f485760 (patch) | |
tree | a6a787b92a73cc3eee58f69a7b9eb286c41d5feb /tools/perf/tests | |
parent | ab3c0ddb0d71dc214b61d11deb8770196ef46c05 (diff) |
perf tests dlfilter: Free desc and long_desc in check_filter_desc
In dlfilter-test.c, check_filter_desc() calls get_filter_desc() which
allocates 'desc' and 'long_desc'. However, these variables are never
deallocated.
This patch adds the missing free() calls.
Fixes: 9f9c9a8de2d5e96c ("perf tests: Add dlfilter test")
Signed-off-by: Riccardo Mancini <rickyman7@gmail.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lore.kernel.org/lkml/20210820113132.724034-1-rickyman7@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/tests')
-rw-r--r-- | tools/perf/tests/dlfilter-test.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/tools/perf/tests/dlfilter-test.c b/tools/perf/tests/dlfilter-test.c index 7eba7955d531..bc03b5df6828 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) |