projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
bd6fecb
)
tools, bpftool: Fix memory leak in codegen error cases
author
Tobias Klauser
<tklauser@distanz.ch>
Wed, 10 Jun 2020 13:08:04 +0000
(15:08 +0200)
committer
Daniel Borkmann
<daniel@iogearbox.net>
Thu, 11 Jun 2020 14:08:48 +0000
(16:08 +0200)
Free the memory allocated for the template on error paths in function
codegen.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Link:
https://lore.kernel.org/bpf/20200610130804.21423-1-tklauser@distanz.ch
tools/bpf/bpftool/gen.c
patch
|
blob
|
history
diff --git
a/tools/bpf/bpftool/gen.c
b/tools/bpf/bpftool/gen.c
index a3c4bb86c05a18588de527360bc73418b726a126..ecbae47e66b82207880fdc5d265d8aa6390b59d6 100644
(file)
--- 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;
}
}