]> git.baikalelectronics.ru Git - kernel.git/commit
libbpf: Fix memory leak/double free issue
authorAndrii Nakryiko <andriin@fb.com>
Thu, 7 Nov 2019 02:08:51 +0000 (18:08 -0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 7 Nov 2019 15:20:37 +0000 (16:20 +0100)
commita881454bc749b04e4bfed973b1d2d0fa007246cf
treec002484aed94bdf2589426e66b140cdbee7d838a
parent671f243b31158b31a0f16a2880837d07f49447a9
libbpf: Fix memory leak/double free issue

Coverity scan against Github libbpf code found the issue of not freeing memory and
leaving already freed memory still referenced from bpf_program. Fix it by
re-assigning successfully reallocated memory sooner.

Fixes: 405046661673 ("tools/bpf: add support to read .BTF.ext sections")
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20191107020855.3834758-2-andriin@fb.com
tools/lib/bpf/libbpf.c