* [PATCH bpf] tools, bpftool: Fix memory leak in codegen error cases
@ 2020-06-10 13:08 Tobias Klauser
2020-06-10 18:31 ` Andrii Nakryiko
2020-06-11 14:24 ` Daniel Borkmann
0 siblings, 2 replies; 3+ messages in thread
From: Tobias Klauser @ 2020-06-10 13:08 UTC (permalink / raw)
To: Alexei Starovoitov, Daniel Borkmann; +Cc: bpf
Free the memory allocated for the template on error paths in function
codegen.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
---
tools/bpf/bpftool/gen.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/bpf/bpftool/gen.c b/tools/bpf/bpftool/gen.c
index a3c4bb86c05a..ecbae47e66b8 100644
--- a/tools/bpf/bpftool/gen.c
+++ b/tools/bpf/bpftool/gen.c
@@ -224,6 +224,7 @@ static int codegen(const char *template, ...)
} else {
p_err("unrecognized character at pos %td in template '%s'",
src - template - 1, template);
+ free(s);
return -EINVAL;
}
}
@@ -234,6 +235,7 @@ static int codegen(const char *template, ...)
if (*src != '\t') {
p_err("not enough tabs at pos %td in template '%s'",
src - template - 1, template);
+ free(s);
return -EINVAL;
}
}
--
2.27.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH bpf] tools, bpftool: Fix memory leak in codegen error cases
2020-06-10 13:08 [PATCH bpf] tools, bpftool: Fix memory leak in codegen error cases Tobias Klauser
@ 2020-06-10 18:31 ` Andrii Nakryiko
2020-06-11 14:24 ` Daniel Borkmann
1 sibling, 0 replies; 3+ messages in thread
From: Andrii Nakryiko @ 2020-06-10 18:31 UTC (permalink / raw)
To: Tobias Klauser; +Cc: Alexei Starovoitov, Daniel Borkmann, bpf
On Wed, Jun 10, 2020 at 6:10 AM Tobias Klauser <tklauser@distanz.ch> wrote:
>
> Free the memory allocated for the template on error paths in function
> codegen.
>
> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
> ---
Acked-by: Andrii Nakryiko <andriin@fb.com>
> tools/bpf/bpftool/gen.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/tools/bpf/bpftool/gen.c b/tools/bpf/bpftool/gen.c
> index a3c4bb86c05a..ecbae47e66b8 100644
> --- a/tools/bpf/bpftool/gen.c
> +++ b/tools/bpf/bpftool/gen.c
> @@ -224,6 +224,7 @@ static int codegen(const char *template, ...)
> } else {
> p_err("unrecognized character at pos %td in template '%s'",
> src - template - 1, template);
> + free(s);
> return -EINVAL;
> }
> }
> @@ -234,6 +235,7 @@ static int codegen(const char *template, ...)
> if (*src != '\t') {
> p_err("not enough tabs at pos %td in template '%s'",
> src - template - 1, template);
> + free(s);
> return -EINVAL;
> }
> }
> --
> 2.27.0
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH bpf] tools, bpftool: Fix memory leak in codegen error cases
2020-06-10 13:08 [PATCH bpf] tools, bpftool: Fix memory leak in codegen error cases Tobias Klauser
2020-06-10 18:31 ` Andrii Nakryiko
@ 2020-06-11 14:24 ` Daniel Borkmann
1 sibling, 0 replies; 3+ messages in thread
From: Daniel Borkmann @ 2020-06-11 14:24 UTC (permalink / raw)
To: Tobias Klauser, Alexei Starovoitov; +Cc: bpf
On 6/10/20 3:08 PM, Tobias Klauser wrote:
> Free the memory allocated for the template on error paths in function
> codegen.
>
> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Applied, thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-06-11 14:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-10 13:08 [PATCH bpf] tools, bpftool: Fix memory leak in codegen error cases Tobias Klauser
2020-06-10 18:31 ` Andrii Nakryiko
2020-06-11 14:24 ` Daniel Borkmann
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.