[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-506fde11a35f39e1b44478339c41e94dfd278aa2@git.kernel.org>
Date: Thu, 9 Feb 2017 23:46:38 -0800
From: tip-bot for Taeung Song <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: peterz@...radead.org, jolsa@...nel.org,
linux-kernel@...r.kernel.org, treeze.taeung@...il.com,
wangnan0@...wei.com, hpa@...or.com, acme@...hat.com,
tglx@...utronix.de, namhyung@...nel.org, mingo@...nel.org
Subject: [tip:perf/core] perf tools: Use zfree() instead of ad hoc
equivalent
Commit-ID: 506fde11a35f39e1b44478339c41e94dfd278aa2
Gitweb: http://git.kernel.org/tip/506fde11a35f39e1b44478339c41e94dfd278aa2
Author: Taeung Song <treeze.taeung@...il.com>
AuthorDate: Wed, 1 Feb 2017 21:34:06 +0900
Committer: Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Wed, 8 Feb 2017 09:41:11 -0300
perf tools: Use zfree() instead of ad hoc equivalent
We have zfree(&ptr) for this very common pattern:
free(ptr);
ptr = NULL;
So use it in a few more places.
Signed-off-by: Taeung Song <treeze.taeung@...il.com>
Cc: Jiri Olsa <jolsa@...nel.org>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Wang Nan <wangnan0@...wei.com>
Link: http://lkml.kernel.org/r/1485952447-7013-4-git-send-email-treeze.taeung@gmail.com
[ rewrote commit log ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
tools/perf/util/parse-events.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 1f1f77d..ab1ba22 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -254,8 +254,7 @@ struct tracepoint_path *tracepoint_name_to_path(const char *name)
if (path->system == NULL || path->name == NULL) {
zfree(&path->system);
zfree(&path->name);
- free(path);
- path = NULL;
+ zfree(&path);
}
return path;
@@ -1482,8 +1481,7 @@ static void perf_pmu__parse_cleanup(void)
p = perf_pmu_events_list + i;
free(p->symbol);
}
- free(perf_pmu_events_list);
- perf_pmu_events_list = NULL;
+ zfree(&perf_pmu_events_list);
perf_pmu_events_list_num = 0;
}
}
Powered by blists - more mailing lists