]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
perf tools: Use zfree() instead of ad hoc equivalent
authorTaeung Song <treeze.taeung@gmail.com>
Wed, 1 Feb 2017 12:34:06 +0000 (21:34 +0900)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 8 Feb 2017 12:41:11 +0000 (09:41 -0300)
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@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: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/parse-events.c

index 1f1f77d8d3abb44838360ad18fd99872a70fd5a1..ab1ba22d879a00fb7a1c6a05ade274c693f305be 100644 (file)
@@ -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;
        }
 }