diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-06-22 10:19:11 -0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-06-22 10:19:11 -0300 |
commit | 32ca678dcd250f05183cf0c8a9e516545c6068bc (patch) | |
tree | 25604da734a20e54457e79e8bc02ec09b631feb0 /tools/perf/util/machine.c | |
parent | 61b3f66a3f99bb8a6a5145b1c2bd7eb98bf64748 (diff) | |
download | op-kernel-dev-32ca678dcd250f05183cf0c8a9e516545c6068bc.zip op-kernel-dev-32ca678dcd250f05183cf0c8a9e516545c6068bc.tar.gz |
perf machine: Destructors should accept NULL
And do nothing, just like free(), to avoid having to test it in callers,
usually in error paths.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-q42gj3b3znhho9z1mrbo4jce@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/machine.c')
-rw-r--r-- | tools/perf/util/machine.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index a0c186a..bc2cdbd 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c @@ -138,8 +138,10 @@ void machine__exit(struct machine *machine) void machine__delete(struct machine *machine) { - machine__exit(machine); - free(machine); + if (machine) { + machine__exit(machine); + free(machine); + } } void machines__init(struct machines *machines) |