projects
/
linux-block.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8e337f7
)
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
Greg Kroah-Hartman
<gregkh@linuxfoundation.org>
Wed, 24 Jun 2020 15:49:10 +0000
(17:49 +0200)
[ Upstream commit
d4060ac969563113101c79433f2ae005feca1c29
]
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
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/bpf/bpftool/gen.c
patch
|
blob
|
blame
|
history
diff --git
a/tools/bpf/bpftool/gen.c
b/tools/bpf/bpftool/gen.c
index f8113b3646f52b328c1ce409fe4da09384dfdf5d..f5960b48c8615a700275d67c9fa4269b09fc055b 100644
(file)
--- a/
tools/bpf/bpftool/gen.c
+++ b/
tools/bpf/bpftool/gen.c
@@
-225,6
+225,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;
}
}
@@
-235,6
+236,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;
}
}