Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

+2 -1
+2 -1
tools/perf/bench/inject-buildid.c
··· 12 12 #include <linux/time64.h> 13 13 #include <linux/list.h> 14 14 #include <linux/err.h> 15 + #include <linux/zalloc.h> 15 16 #include <internal/lib.h> 16 17 #include <subcmd/parse-options.h> 17 18 ··· 123 122 for (i = 0; i < nr_dsos; i++) { 124 123 struct bench_dso *dso = &dsos[i]; 125 124 126 - free(dso->name); 125 + zfree(&dso->name); 127 126 } 128 127 free(dsos); 129 128 }