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 09:57:16 -0300 |
commit | d729163d0641d8b4c50fdca1b2b9d5d24d9d376d (patch) | |
tree | 178a83698e087e242c5e26d3bf17535172b9ac40 /tools | |
parent | b20c63084eb2c591006109aefbdeb3cad7a57d23 (diff) | |
download | linux-stable-d729163d0641d8b4c50fdca1b2b9d5d24d9d376d.tar.gz linux-stable-d729163d0641d8b4c50fdca1b2b9d5d24d9d376d.tar.bz2 linux-stable-d729163d0641d8b4c50fdca1b2b9d5d24d9d376d.zip |
perf symbol: 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/util/symbol-elf.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index c55981116f68..35724f6a84fa 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c @@ -396,7 +396,7 @@ static bool get_ifunc_name(Elf *elf, struct dso *dso, GElf_Ehdr *ehdr, static void exit_rel(struct rel_info *ri) { - free(ri->sorted); + zfree(&ri->sorted); } static bool get_plt_sizes(struct dso *dso, GElf_Ehdr *ehdr, GElf_Shdr *shdr_plt, @@ -460,7 +460,7 @@ struct rela_dyn_info { static void exit_rela_dyn(struct rela_dyn_info *di) { - free(di->sorted); + zfree(&di->sorted); } static int cmp_offset(const void *a, const void *b) |