mirror of
https://github.com/netdata/libbpf.git
synced 2026-04-10 10:39:07 +08:00
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
This commit is contained in:
committed by
Andrii Nakryiko
parent
d7982f3948
commit
eb10610a3b
@@ -2991,8 +2991,10 @@ int btf__dedup(struct btf *btf, struct btf_ext *btf_ext,
|
|||||||
return libbpf_err(-EINVAL);
|
return libbpf_err(-EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (btf_ensure_modifiable(btf))
|
if (btf_ensure_modifiable(btf)) {
|
||||||
return libbpf_err(-ENOMEM);
|
err = -ENOMEM;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
err = btf_dedup_prep(d);
|
err = btf_dedup_prep(d);
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|||||||
Reference in New Issue
Block a user