aboutsummaryrefslogtreecommitdiffstats
path: root/tools/lib/bpf/libbpf_legacy.h
diff options
context:
space:
mode:
authorQuentin Monnet <[email protected]>2021-10-22 09:47:43 +0000
committerAndrii Nakryiko <[email protected]>2021-10-22 23:44:56 +0000
commite89ef634f81c9d90e1824ab183721f3b361472e6 (patch)
tree1eec7ee66d53cc820e11d78009bb21087e0dc7b2 /tools/lib/bpf/libbpf_legacy.h
parentMerge branch 'libbpf: Add btf__type_cnt() and btf__raw_data() APIs' (diff)
downloadkernel-e89ef634f81c9d90e1824ab183721f3b361472e6.tar.gz
kernel-e89ef634f81c9d90e1824ab183721f3b361472e6.zip
bpftool: Avoid leaking the JSON writer prepared for program metadata
Bpftool creates a new JSON object for writing program metadata in plain text mode, regardless of metadata being present or not. Then this writer is freed if any metadata has been found and printed, but it leaks otherwise. We cannot destroy the object unconditionally, because the destructor prints an undesirable line break. Instead, make sure the writer is created only after we have found program metadata to print. Found with valgrind. Fixes: aff52e685eb3 ("bpftool: Support dumping metadata") Signed-off-by: Quentin Monnet <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
Diffstat (limited to 'tools/lib/bpf/libbpf_legacy.h')
0 files changed, 0 insertions, 0 deletions