diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-12-26 13:54:57 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-12-26 13:58:52 -0500 |
commit | f5385650c02cd4373c4124c8a8fac3b5f9851e7f (patch) | |
tree | 93d2a59ebf378289abf9853ab2da49c70ac80633 /tools/perf/util/probe-finder.c | |
parent | 6dd601354f14b5cd7a0a4103811e52ccec22ac53 (diff) |
perf tools: No need to test against NULL before calling free()
Its perfectly fine to call free(NULL), so no need to clutter the source
code with all those superfluous testing.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-uux5wpvevlerd42gqer13e7n@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/probe-finder.c')
-rw-r--r-- | tools/perf/util/probe-finder.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c index 7db7e05ccb89..8c087359b7ce 100644 --- a/tools/perf/util/probe-finder.c +++ b/tools/perf/util/probe-finder.c | |||
@@ -1414,10 +1414,8 @@ int debuginfo__find_available_vars_at(struct debuginfo *dbg, | |||
1414 | if (ret < 0) { | 1414 | if (ret < 0) { |
1415 | /* Free vlist for error */ | 1415 | /* Free vlist for error */ |
1416 | while (af.nvls--) { | 1416 | while (af.nvls--) { |
1417 | if (af.vls[af.nvls].point.symbol) | 1417 | free(af.vls[af.nvls].point.symbol); |
1418 | free(af.vls[af.nvls].point.symbol); | 1418 | strlist__delete(af.vls[af.nvls].vars); |
1419 | if (af.vls[af.nvls].vars) | ||
1420 | strlist__delete(af.vls[af.nvls].vars); | ||
1421 | } | 1419 | } |
1422 | free(af.vls); | 1420 | free(af.vls); |
1423 | *vls = NULL; | 1421 | *vls = NULL; |
@@ -1524,10 +1522,8 @@ post: | |||
1524 | if (fname) { | 1522 | if (fname) { |
1525 | ppt->file = strdup(fname); | 1523 | ppt->file = strdup(fname); |
1526 | if (ppt->file == NULL) { | 1524 | if (ppt->file == NULL) { |
1527 | if (ppt->function) { | 1525 | free(ppt->function); |
1528 | free(ppt->function); | 1526 | ppt->function = NULL; |
1529 | ppt->function = NULL; | ||
1530 | } | ||
1531 | ret = -ENOMEM; | 1527 | ret = -ENOMEM; |
1532 | goto end; | 1528 | goto end; |
1533 | } | 1529 | } |