mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
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>
This commit is contained in:
parent
e413f9f13f
commit
97d0dd1e28
1 changed files with 2 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue