diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2023-04-12 09:50:08 -0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2023-04-12 10:12:55 -0300 |
commit | e413f9f13f6a8a591af0ac39ef50af02b42a0df8 (patch) | |
tree | d4cfaaaa8487f91f30e3572a2e6164bdf0899074 /tools | |
parent | 2bfc8134f95852bd8b0190641c2d2b059cb1c8cc (diff) | |
download | linux-stable-e413f9f13f6a8a591af0ac39ef50af02b42a0df8.tar.gz linux-stable-e413f9f13f6a8a591af0ac39ef50af02b42a0df8.tar.bz2 linux-stable-e413f9f13f6a8a591af0ac39ef50af02b42a0df8.zip |
perf genelf: Use zfree() to reduce chances of use after free
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>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/util/genelf_debug.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/perf/util/genelf_debug.c b/tools/perf/util/genelf_debug.c index 8786c366566e..aa5dcc56b2ac 100644 --- 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 |