Commit 506fde11 authored by Taeung Song's avatar Taeung Song Committed by Arnaldo Carvalho de Melo

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: default avatarTaeung Song <treeze.taeung@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1485952447-7013-4-git-send-email-treeze.taeung@gmail.com
[ rewrote commit log ]
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 5aa365f2
...@@ -254,8 +254,7 @@ struct tracepoint_path *tracepoint_name_to_path(const char *name) ...@@ -254,8 +254,7 @@ struct tracepoint_path *tracepoint_name_to_path(const char *name)
if (path->system == NULL || path->name == NULL) { if (path->system == NULL || path->name == NULL) {
zfree(&path->system); zfree(&path->system);
zfree(&path->name); zfree(&path->name);
free(path); zfree(&path);
path = NULL;
} }
return path; return path;
...@@ -1482,8 +1481,7 @@ static void perf_pmu__parse_cleanup(void) ...@@ -1482,8 +1481,7 @@ static void perf_pmu__parse_cleanup(void)
p = perf_pmu_events_list + i; p = perf_pmu_events_list + i;
free(p->symbol); free(p->symbol);
} }
free(perf_pmu_events_list); zfree(&perf_pmu_events_list);
perf_pmu_events_list = NULL;
perf_pmu_events_list_num = 0; perf_pmu_events_list_num = 0;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment