projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
2bfc813
)
perf genelf: Use zfree() to reduce chances of use after free
author
Arnaldo Carvalho de Melo
<acme@redhat.com>
Wed, 12 Apr 2023 12:50:08 +0000
(09:50 -0300)
committer
Arnaldo Carvalho de Melo
<acme@redhat.com>
Wed, 12 Apr 2023 13:12:55 +0000
(10:12 -0300)
Do defensive programming by using zfree() to initialize freed pointers
to NULL, so that eventual use after free result in a NULL pointer deref
instead of more subtle behaviour.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/genelf_debug.c
patch
|
blob
|
history
diff --git
a/tools/perf/util/genelf_debug.c
b/tools/perf/util/genelf_debug.c
index 8786c366566e6350665271f0b20e3d62097dd87c..aa5dcc56b2ac865da9b646bf8415ba74d00ca51b 100644
(file)
--- a/
tools/perf/util/genelf_debug.c
+++ b/
tools/perf/util/genelf_debug.c
@@
-11,6
+11,7
@@
* @author Philippe Elie
*/
#include <linux/compiler.h>
+#include <linux/zalloc.h>
#include <sys/types.h>
#include <stdio.h>
#include <getopt.h>
@@
-90,7
+91,7
@@
buffer_ext_init(struct buffer_ext *be)
static void
buffer_ext_exit(struct buffer_ext *be)
{
-
free(
be->data);
+
zfree(&
be->data);
}
static inline size_t