projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
57385ae
)
libbpf: Fix memory leak in btf__dedup()
author
Mauricio Vásquez
<mauricio@kinvolk.io>
Fri, 22 Oct 2021 20:20:35 +0000
(15:20 -0500)
committer
Andrii Nakryiko
<andrii@kernel.org>
Fri, 22 Oct 2021 23:00:53 +0000
(16:00 -0700)
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
tools/lib/bpf/btf.c
patch
|
blob
|
history
diff --git
a/tools/lib/bpf/btf.c
b/tools/lib/bpf/btf.c
index 3a01c4b7f36ab04d4809232b8b4a994b1b5433f6..85705c10f7b25328206759685b760abe3a7b0ea2 100644
(file)
--- a/
tools/lib/bpf/btf.c
+++ b/
tools/lib/bpf/btf.c
@@
-2991,8
+2991,10
@@
int btf__dedup(struct btf *btf, struct btf_ext *btf_ext,
return libbpf_err(-EINVAL);
}
- if (btf_ensure_modifiable(btf))
- return libbpf_err(-ENOMEM);
+ if (btf_ensure_modifiable(btf)) {
+ err = -ENOMEM;
+ goto done;
+ }
err = btf_dedup_prep(d);
if (err) {