diff options
| author | Jiri Olsa <[email protected]> | 2021-07-21 21:58:08 +0000 |
|---|---|---|
| committer | Andrii Nakryiko <[email protected]> | 2021-07-23 03:08:39 +0000 |
| commit | 1f71a468a75ff4f13c55966c74284aa4a6bcc334 (patch) | |
| tree | ee345cc538961b595a88067e8ff47f62c6809424 /tools/lib/bpf/libbpf.c | |
| parent | selftests/bpf: Mute expected invalid map creation error msg (diff) | |
| download | kernel-1f71a468a75ff4f13c55966c74284aa4a6bcc334.tar.gz kernel-1f71a468a75ff4f13c55966c74284aa4a6bcc334.zip | |
libbpf: Fix func leak in attach_kprobe
Add missing free() for func pointer in attach_kprobe function.
Fixes: a2488b5f483f ("libbpf: Allow specification of "kprobe/function+offset"")
Reported-by: Andrii Nakryiko <[email protected]>
Signed-off-by: Jiri Olsa <[email protected]>
Signed-off-by: Andrii Nakryiko <[email protected]>
Reviewed-by: Alan Maguire <[email protected]>
Tested-by: Alan Maguire <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
Diffstat (limited to 'tools/lib/bpf/libbpf.c')
| -rw-r--r-- | tools/lib/bpf/libbpf.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index 4c153c379989..d46c2dd37be2 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -10431,6 +10431,7 @@ static struct bpf_link *attach_kprobe(const struct bpf_sec_def *sec, return libbpf_err_ptr(err); } if (opts.retprobe && offset != 0) { + free(func); err = -EINVAL; pr_warn("kretprobes do not support offset specification\n"); return libbpf_err_ptr(err); |
