perf tools: Use zfree to help detect use after free bugs

Several areas already used this technique, so do some audit to
consistently use it elsewhere.

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-9sbere0kkplwe45ak6rk4a1f@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Arnaldo Carvalho de Melo 2013-12-27 16:55:14 -03:00
parent 046625231a
commit 74cf249d5c
29 changed files with 83 additions and 80 deletions

View file

@ -41,7 +41,7 @@ struct thread_map *thread_map__new_by_pid(pid_t pid)
}
for (i=0; i<items; i++)
free(namelist[i]);
zfree(&namelist[i]);
free(namelist);
return threads;
@ -118,7 +118,7 @@ struct thread_map *thread_map__new_by_uid(uid_t uid)
threads->map[threads->nr + i] = atoi(namelist[i]->d_name);
for (i = 0; i < items; i++)
free(namelist[i]);
zfree(&namelist[i]);
free(namelist);
threads->nr += items;
@ -135,7 +135,7 @@ out_free_threads:
out_free_namelist:
for (i = 0; i < items; i++)
free(namelist[i]);
zfree(&namelist[i]);
free(namelist);
out_free_closedir:
@ -194,7 +194,7 @@ static struct thread_map *thread_map__new_by_pid_str(const char *pid_str)
for (i = 0; i < items; i++) {
threads->map[j++] = atoi(namelist[i]->d_name);
free(namelist[i]);
zfree(&namelist[i]);
}
threads->nr = total_tasks;
free(namelist);
@ -206,7 +206,7 @@ out:
out_free_namelist:
for (i = 0; i < items; i++)
free(namelist[i]);
zfree(&namelist[i]);
free(namelist);
out_free_threads: