diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2019-07-04 18:06:20 +0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2019-07-09 16:13:27 +0300 |
commit | d8f9da240495b50766239410f9b0c715ca506a67 (patch) | |
tree | a9fb3abcc48a72cd34a9299f081aab497325711f /tools/perf/util/symbol-elf.c | |
parent | 7f7c536f23e6afaa5d5d4b0e0958b0be8922491f (diff) | |
download | linux-d8f9da240495b50766239410f9b0c715ca506a67.tar.xz |
perf tools: Use zfree() where applicable
In places where the equivalent was already being done, i.e.:
free(a);
a = NULL;
And in placs where struct members are being freed so that if we have
some erroneous reference to its struct, then accesses to freed members
will result in segfaults, which we can detect faster than use after free
to areas that may still have something seemingly valid.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lkml.kernel.org/n/tip-jatyoofo5boc1bsvoig6bb6i@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/symbol-elf.c')
-rw-r--r-- | tools/perf/util/symbol-elf.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index ad683fbe9678..1d5447594f5d 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c @@ -2133,11 +2133,11 @@ static int populate_sdt_note(Elf **elf, const char *data, size_t len, return 0; out_free_args: - free(tmp->args); + zfree(&tmp->args); out_free_name: - free(tmp->name); + zfree(&tmp->name); out_free_prov: - free(tmp->provider); + zfree(&tmp->provider); out_free_note: free(tmp); out_err: @@ -2253,8 +2253,8 @@ int cleanup_sdt_note_list(struct list_head *sdt_notes) list_for_each_entry_safe(pos, tmp, sdt_notes, note_list) { list_del(&pos->note_list); - free(pos->name); - free(pos->provider); + zfree(&pos->name); + zfree(&pos->provider); free(pos); nr_free++; } |