diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2023-04-12 14:50:08 +0200 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2023-04-12 15:14:01 +0200 |
commit | 97d0dd1e283a9a11ede495928c9c2a148b47cef4 (patch) | |
tree | f53a6a9f2e96889bbffbda62df48f8e5b5899d64 /tools/perf/bench/inject-buildid.c | |
parent | perf genelf: Use zfree() to reduce chances of use after free (diff) | |
download | linux-97d0dd1e283a9a11ede495928c9c2a148b47cef4.tar.xz linux-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/perf/bench/inject-buildid.c')
-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); } |