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 parse-events: 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.

Also remove one NULL test before free(), as it accepts a NULL arg and we
get one line shaved not doing it explicitely.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

+1 -1
+1 -1
tools/perf/util/parse-events.c
··· 2020 2020 2021 2021 err_free: 2022 2022 for (j = 0, tmp = list; j < i; j++, tmp++) 2023 - free(tmp->symbol); 2023 + zfree(&tmp->symbol); 2024 2024 free(list); 2025 2025 return -ENOMEM; 2026 2026 }