Home
last modified time | relevance | path

Searched hist:e89ef634f81c9d90e1824ab183721f3b361472e6 (Results 1 – 1 of 1) sorted by relevance

/openbmc/linux/tools/bpf/bpftool/
H A Dprog.cdiff e89ef634f81c9d90e1824ab183721f3b361472e6 Fri Oct 22 04:47:43 CDT 2021 Quentin Monnet <quentin@isovalent.com> 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 <quentin@isovalent.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20211022094743.11052-1-quentin@isovalent.com