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>
This commit is contained in:
@@ -1414,10 +1414,8 @@ int debuginfo__find_available_vars_at(struct debuginfo *dbg,
|
||||
if (ret < 0) {
|
||||
/* Free vlist for error */
|
||||
while (af.nvls--) {
|
||||
if (af.vls[af.nvls].point.symbol)
|
||||
free(af.vls[af.nvls].point.symbol);
|
||||
if (af.vls[af.nvls].vars)
|
||||
strlist__delete(af.vls[af.nvls].vars);
|
||||
free(af.vls[af.nvls].point.symbol);
|
||||
strlist__delete(af.vls[af.nvls].vars);
|
||||
}
|
||||
free(af.vls);
|
||||
*vls = NULL;
|
||||
@@ -1524,10 +1522,8 @@ post:
|
||||
if (fname) {
|
||||
ppt->file = strdup(fname);
|
||||
if (ppt->file == NULL) {
|
||||
if (ppt->function) {
|
||||
free(ppt->function);
|
||||
ppt->function = NULL;
|
||||
}
|
||||
free(ppt->function);
|
||||
ppt->function = NULL;
|
||||
ret = -ENOMEM;
|
||||
goto end;
|
||||
}
|
||||
|
Reference in New Issue
Block a user