mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 09:04:39 +02:00
selftests/bpf: Free per-cpu values array in bpf_iter selftest
Array holding per-cpu values wasn't freed. Fix that. Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20211107165521.9240-5-andrii@kernel.org
This commit is contained in:
parent
8ba2858749
commit
b8b26e585f
|
|
@ -699,14 +699,13 @@ static void test_bpf_percpu_hash_map(void)
|
|||
char buf[64];
|
||||
void *val;
|
||||
|
||||
val = malloc(8 * bpf_num_possible_cpus());
|
||||
|
||||
skel = bpf_iter_bpf_percpu_hash_map__open();
|
||||
if (CHECK(!skel, "bpf_iter_bpf_percpu_hash_map__open",
|
||||
"skeleton open failed\n"))
|
||||
return;
|
||||
|
||||
skel->rodata->num_cpus = bpf_num_possible_cpus();
|
||||
val = malloc(8 * bpf_num_possible_cpus());
|
||||
|
||||
err = bpf_iter_bpf_percpu_hash_map__load(skel);
|
||||
if (CHECK(!skel, "bpf_iter_bpf_percpu_hash_map__load",
|
||||
|
|
@ -770,6 +769,7 @@ static void test_bpf_percpu_hash_map(void)
|
|||
bpf_link__destroy(link);
|
||||
out:
|
||||
bpf_iter_bpf_percpu_hash_map__destroy(skel);
|
||||
free(val);
|
||||
}
|
||||
|
||||
static void test_bpf_array_map(void)
|
||||
|
|
@ -870,14 +870,13 @@ static void test_bpf_percpu_array_map(void)
|
|||
void *val;
|
||||
int len;
|
||||
|
||||
val = malloc(8 * bpf_num_possible_cpus());
|
||||
|
||||
skel = bpf_iter_bpf_percpu_array_map__open();
|
||||
if (CHECK(!skel, "bpf_iter_bpf_percpu_array_map__open",
|
||||
"skeleton open failed\n"))
|
||||
return;
|
||||
|
||||
skel->rodata->num_cpus = bpf_num_possible_cpus();
|
||||
val = malloc(8 * bpf_num_possible_cpus());
|
||||
|
||||
err = bpf_iter_bpf_percpu_array_map__load(skel);
|
||||
if (CHECK(!skel, "bpf_iter_bpf_percpu_array_map__load",
|
||||
|
|
@ -933,6 +932,7 @@ static void test_bpf_percpu_array_map(void)
|
|||
bpf_link__destroy(link);
|
||||
out:
|
||||
bpf_iter_bpf_percpu_array_map__destroy(skel);
|
||||
free(val);
|
||||
}
|
||||
|
||||
/* An iterator program deletes all local storage in a map. */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user