diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2019-07-04 12:06:20 -0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2019-07-09 10:13:27 -0300 |
commit | d8f9da240495b50766239410f9b0c715ca506a67 (patch) | |
tree | a9fb3abcc48a72cd34a9299f081aab497325711f /tools/perf/util/s390-cpumsf.c | |
parent | 7f7c536f23e6afaa5d5d4b0e0958b0be8922491f (diff) | |
download | blackbird-op-linux-d8f9da240495b50766239410f9b0c715ca506a67.tar.gz blackbird-op-linux-d8f9da240495b50766239410f9b0c715ca506a67.zip |
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/s390-cpumsf.c')
-rw-r--r-- | tools/perf/util/s390-cpumsf.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/tools/perf/util/s390-cpumsf.c b/tools/perf/util/s390-cpumsf.c index ea669702825d..cca9cb851d02 100644 --- a/tools/perf/util/s390-cpumsf.c +++ b/tools/perf/util/s390-cpumsf.c @@ -1044,7 +1044,7 @@ static void s390_cpumsf_free(struct perf_session *session) auxtrace_heap__free(&sf->heap); s390_cpumsf_free_queues(session); session->auxtrace = NULL; - free(sf->logdir); + zfree(&sf->logdir); free(sf); } @@ -1101,8 +1101,7 @@ static int s390_cpumsf__config(const char *var, const char *value, void *cb) if (rc == -1 || !S_ISDIR(stbuf.st_mode)) { pr_err("Missing auxtrace log directory %s," " continue with current directory...\n", value); - free(sf->logdir); - sf->logdir = NULL; + zfree(&sf->logdir); } return 1; } @@ -1162,7 +1161,7 @@ err_free_queues: auxtrace_queues__free(&sf->queues); session->auxtrace = NULL; err_free: - free(sf->logdir); + zfree(&sf->logdir); free(sf); return err; } |