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:14:01 -0300 |
commit | 97d0dd1e283a9a11ede495928c9c2a148b47cef4 (patch) | |
tree | f53a6a9f2e96889bbffbda62df48f8e5b5899d64 /tools | |
parent | e413f9f13f6a8a591af0ac39ef50af02b42a0df8 (diff) | |
download | linux-stable-97d0dd1e283a9a11ede495928c9c2a148b47cef4.tar.gz linux-stable-97d0dd1e283a9a11ede495928c9c2a148b47cef4.tar.bz2 linux-stable-97d0dd1e283a9a11ede495928c9c2a148b47cef4.zip |
perf bench inject-buildid: 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/bench/inject-buildid.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/perf/bench/inject-buildid.c b/tools/perf/bench/inject-buildid.c index 4561bda0ce6a..49331743c743 100644 --- a/tools/perf/bench/inject-buildid.c +++ b/tools/perf/bench/inject-buildid.c @@ -12,6 +12,7 @@ #include <linux/time64.h> #include <linux/list.h> #include <linux/err.h> +#include <linux/zalloc.h> #include <internal/lib.h> #include <subcmd/parse-options.h> @@ -122,7 +123,7 @@ static void release_dso(void) for (i = 0; i < nr_dsos; i++) { struct bench_dso *dso = &dsos[i]; - free(dso->name); + zfree(&dso->name); } free(dsos); } |