]> git.baikalelectronics.ru Git - kernel.git/commit
libbpf: Fix the possible memory leak on error
authorShuyi Cheng <chengshuyi@linux.alibaba.com>
Tue, 13 Jul 2021 12:42:38 +0000 (20:42 +0800)
committerAndrii Nakryiko <andrii@kernel.org>
Fri, 16 Jul 2021 20:22:47 +0000 (13:22 -0700)
commit6e8fa9f42b5b1ab671b3561a21d8d59dae87348a
tree671a7fee2cf31dca2d5a840c96ab94bf3c59a0be
parentc35a2644d6f971d0fbb8ba29b76fd1122d9a3f3f
libbpf: Fix the possible memory leak on error

If the strdup() fails then we need to call bpf_object__close(obj) to
avoid a resource leak.

Fixes: 8a519035787d ("libbpf: Support libbpf-provided extern variables")
Signed-off-by: Shuyi Cheng <chengshuyi@linux.alibaba.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/1626180159-112996-3-git-send-email-chengshuyi@linux.alibaba.com
tools/lib/bpf/libbpf.c