Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

libbpf: Fix memory leak in btf__dedup()

Free btf_dedup if btf_ensure_modifiable() returns error.

Fixes: 919d2b1dbb07 ("libbpf: Allow modification of BTF and add btf__add_str API")
Signed-off-by: Mauricio Vásquez <mauricio@kinvolk.io>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20211022202035.48868-1-mauricio@kinvolk.io

authored by

Mauricio Vásquez and committed by
Andrii Nakryiko
1000298c 57385ae3

+4 -2
+4 -2
tools/lib/bpf/btf.c
··· 2991 2991 return libbpf_err(-EINVAL); 2992 2992 } 2993 2993 2994 - if (btf_ensure_modifiable(btf)) 2995 - return libbpf_err(-ENOMEM); 2994 + if (btf_ensure_modifiable(btf)) { 2995 + err = -ENOMEM; 2996 + goto done; 2997 + } 2996 2998 2997 2999 err = btf_dedup_prep(d); 2998 3000 if (err) {