libbpf: Free up resources used by inner map definition
authorAndrii Nakryiko <andrii@kernel.org>
Sun, 7 Nov 2021 16:55:14 +0000 (08:55 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Jan 2022 10:03:06 +0000 (11:03 +0100)
commita3ec2b9456eb8155772dadef6411985be876b188
tree36d2bf4c198ec92a370caf4c4a0e1ab13c67023c
parent620a2ee5505921521f47da78db01f846a818fab0
libbpf: Free up resources used by inner map definition

[ Upstream commit 8f7b239ea8cfdc8e64c875ee417fed41431a1f37 ]

It's not enough to just free(map->inner_map), as inner_map itself can
have extra memory allocated, like map name.

Fixes: 646f02ffdd49 ("libbpf: Add BTF-defined map-in-map support")
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Reviewed-by: Hengqi Chen <hengqi.chen@gmail.com>
Link: https://lore.kernel.org/bpf/20211107165521.9240-3-andrii@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/lib/bpf/libbpf.c