提交 6ca822e5 编写于 作者: R Riccardo Mancini 提交者: Arnaldo Carvalho de Melo

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: 9f9c9a8d ("perf tests: Add dlfilter test")
Signed-off-by: NRiccardo Mancini <rickyman7@gmail.com>
Acked-by: NAdrian 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.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 ab3c0ddb
...@@ -239,15 +239,20 @@ static int get_dlfilters_path(char *buf, size_t sz) ...@@ -239,15 +239,20 @@ static int get_dlfilters_path(char *buf, size_t sz)
static int check_filter_desc(struct test_data *td) static int check_filter_desc(struct test_data *td)
{ {
char *long_desc; char *long_desc = NULL;
char *desc; char *desc = NULL;
int ret;
if (get_filter_desc(td->dlfilters, "dlfilter-test-api-v0.so", &desc, &long_desc) && 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") && long_desc && !strcmp(long_desc, "Filter used by the 'dlfilter C API' perf test") &&
desc && !strcmp(desc, "dlfilter to test v0 C API")) 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) static int get_ip_addr(struct test_data *td)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册