libbpf: Use libbpf_mem_ensure() when allocating new map
authorAndrii Nakryiko <andrii@kernel.org>
Thu, 28 Apr 2022 04:15:21 +0000 (21:15 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 29 Apr 2022 03:03:29 +0000 (20:03 -0700)
commit69721203b1f3f9d123ae0f81bbf41f9a85185859
tree6d6592563e6ffba0093926826f57b73c99a17cf3
parentb198881d4b4c22c499168421b44eff3913a22fb1
libbpf: Use libbpf_mem_ensure() when allocating new map

Reuse libbpf_mem_ensure() when adding a new map to the list of maps
inside bpf_object. It takes care of proper resizing and reallocating of
map array and zeroing out newly allocated memory.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20220428041523.4089853-3-andrii@kernel.org
tools/lib/bpf/libbpf.c