linux-stable/tools
Quentin Monnet e89ef634f8 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: aff52e685e ("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
2021-10-22 16:44:56 -07:00
..
accounting
arch A set of fixes for X86: 2021-09-26 10:09:20 -07:00
bootconfig tools/bootconfig: Define memblock_free_ptr() to fix build error 2021-09-15 09:49:48 -07:00
bpf bpftool: Avoid leaking the JSON writer prepared for program metadata 2021-10-22 16:44:56 -07:00
build perf cs-etm: Update OpenCSD decoder for ETE 2021-09-03 08:16:00 -03:00
cgroup
debugging
edid
firewire
firmware
gpio
hv
iio
include bpf: Add verified_insns to bpf_prog_info and fdinfo 2021-10-21 15:51:47 -07:00
io_uring tools/io_uring/io_uring-cp: sync with liburing example 2021-08-13 08:58:11 -06:00
kvm/kvm_stat
laptop
leds
lib libbpf: Add btf__type_cnt() and btf__raw_data() APIs 2021-10-22 16:09:14 -07:00
memory-model
objtool
pci tools: PCI: Zero-initialize param 2021-08-05 11:01:30 +01:00
pcmcia
perf perf bpf: Switch to new btf__raw_data API 2021-10-22 16:09:14 -07:00
power
rcu
scripts
spi
testing selftests/bpf: Switch to new btf__type_cnt/btf__raw_data APIs 2021-10-22 16:09:14 -07:00
thermal/tmon tools/thermal/tmon: Add cross compiling support 2021-08-14 15:33:19 +02:00
time
tracing
usb usb: testusb: Fix for showing the connection speed 2021-09-14 10:31:41 +02:00
virtio tools/virtio: fix build 2021-08-11 06:44:24 -04:00
vm tools/vm/page-types: remove dependency on opt_file for idle page tracking 2021-09-24 16:13:35 -07:00
wmi
Makefile