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:
@@ -204,7 +204,7 @@ struct tracepoint_path *tracepoint_id_to_path(u64 config)
|
||||
}
|
||||
path->name = malloc(MAX_EVENT_LENGTH);
|
||||
if (!path->name) {
|
||||
free(path->system);
|
||||
zfree(&path->system);
|
||||
free(path);
|
||||
return NULL;
|
||||
}
|
||||
@@ -236,8 +236,8 @@ struct tracepoint_path *tracepoint_name_to_path(const char *name)
|
||||
path->name = strdup(str+1);
|
||||
|
||||
if (path->system == NULL || path->name == NULL) {
|
||||
free(path->system);
|
||||
free(path->name);
|
||||
zfree(&path->system);
|
||||
zfree(&path->name);
|
||||
free(path);
|
||||
path = NULL;
|
||||
}
|
||||
@@ -917,7 +917,7 @@ int parse_events_terms(struct list_head *terms, const char *str)
|
||||
ret = parse_events__scanner(str, &data, PE_START_TERMS);
|
||||
if (!ret) {
|
||||
list_splice(data.terms, terms);
|
||||
free(data.terms);
|
||||
zfree(&data.terms);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user