libbpf: Fix memory leak in legacy kprobe attach logic
authorAndrii Nakryiko <andrii@kernel.org>
Tue, 21 Sep 2021 21:00:33 +0000 (14:00 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 22 Sep 2021 02:40:08 +0000 (19:40 -0700)
commit303a257223a3bbd7cc6ccc2b7777179c8d9f3989
tree69df1a1ac0a8f11d0e62c0fba913d00992446cc4
parentcf8980a362353c5ebb3efb9b09e9fda17e0abfa4
libbpf: Fix memory leak in legacy kprobe attach logic

In some error scenarios legacy_probe string won't be free()'d. Fix this.
This was reported by Coverity static analysis.

Fixes: ca304b40c20d ("libbpf: Introduce legacy kprobe events support")
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20210921210036.1545557-2-andrii@kernel.org
tools/lib/bpf/libbpf.c