On Sat, Oct 3, 2020 at 1:55 AM Hangbin Liu <liuhangbin@xxxxxxxxx> wrote: > > Previously we forgot to close the map fd if bpf_map_update_elem() > failed during map slot init, which will leak map fd. > > Let's move map slot initialization to new function init_map_slots() to > simplify the code. And close the map fd if init slot failed. > > Reported-by: Andrii Nakryiko <andrii.nakryiko@xxxxxxxxx> > Signed-off-by: Hangbin Liu <liuhangbin@xxxxxxxxx> > --- LGTM, thanks for the fix! Acked-by: Andrii Nakryiko <andrii@xxxxxxxxxx> > tools/lib/bpf/libbpf.c | 55 ++++++++++++++++++++++++++---------------- > 1 file changed, 34 insertions(+), 21 deletions(-) > [...]