]> git.baikalelectronics.ru Git - kernel.git/commitdiff
libbpf: Fix memory leak in strset
authorAndrii Nakryiko <andrii@kernel.org>
Fri, 1 Oct 2021 18:59:10 +0000 (11:59 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Fri, 1 Oct 2021 20:54:38 +0000 (22:54 +0200)
Free struct strset itself, not just its internal parts.

Fixes: 90d76d3ececc ("libbpf: Extract internal set-of-strings datastructure APIs")
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Link: https://lore.kernel.org/bpf/20211001185910.86492-1-andrii@kernel.org
tools/lib/bpf/strset.c

index 1fb8b49de1d628b2ac6749754114cfee0576c468..ea655318153f26b926c4e1ee7a6e2e9f55e35eee 100644 (file)
@@ -88,6 +88,7 @@ void strset__free(struct strset *set)
 
        hashmap__free(set->strs_hash);
        free(set->strs_data);
+       free(set);
 }
 
 size_t strset__data_size(const struct strset *set)