diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-12-27 14:55:14 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-12-27 15:08:19 -0500 |
commit | 74cf249d5cf7de84c88cca69a2f13b13d500ff94 (patch) | |
tree | fc61aabd22d981e95fe6ffe9a839e07bbb1f95a0 /tools/perf/util/annotate.c | |
parent | 046625231a0397f1776eb353a4ec9ff142cd2f6b (diff) |
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>
Diffstat (limited to 'tools/perf/util/annotate.c')
-rw-r--r-- | tools/perf/util/annotate.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index a78721d14694..469eb679fb9d 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c | |||
@@ -26,10 +26,10 @@ static int disasm_line__parse(char *line, char **namep, char **rawp); | |||
26 | 26 | ||
27 | static void ins__delete(struct ins_operands *ops) | 27 | static void ins__delete(struct ins_operands *ops) |
28 | { | 28 | { |
29 | free(ops->source.raw); | 29 | zfree(&ops->source.raw); |
30 | free(ops->source.name); | 30 | zfree(&ops->source.name); |
31 | free(ops->target.raw); | 31 | zfree(&ops->target.raw); |
32 | free(ops->target.name); | 32 | zfree(&ops->target.name); |
33 | } | 33 | } |
34 | 34 | ||
35 | static int ins__raw_scnprintf(struct ins *ins, char *bf, size_t size, | 35 | static int ins__raw_scnprintf(struct ins *ins, char *bf, size_t size, |
@@ -204,9 +204,9 @@ static int lock__scnprintf(struct ins *ins, char *bf, size_t size, | |||
204 | 204 | ||
205 | static void lock__delete(struct ins_operands *ops) | 205 | static void lock__delete(struct ins_operands *ops) |
206 | { | 206 | { |
207 | free(ops->locked.ops); | 207 | zfree(&ops->locked.ops); |
208 | free(ops->target.raw); | 208 | zfree(&ops->target.raw); |
209 | free(ops->target.name); | 209 | zfree(&ops->target.name); |
210 | } | 210 | } |
211 | 211 | ||
212 | static struct ins_ops lock_ops = { | 212 | static struct ins_ops lock_ops = { |
@@ -583,7 +583,7 @@ static struct disasm_line *disasm_line__new(s64 offset, char *line, size_t privs | |||
583 | return dl; | 583 | return dl; |
584 | 584 | ||
585 | out_free_line: | 585 | out_free_line: |
586 | free(dl->line); | 586 | zfree(&dl->line); |
587 | out_delete: | 587 | out_delete: |
588 | free(dl); | 588 | free(dl); |
589 | return NULL; | 589 | return NULL; |
@@ -591,8 +591,8 @@ out_delete: | |||
591 | 591 | ||
592 | void disasm_line__free(struct disasm_line *dl) | 592 | void disasm_line__free(struct disasm_line *dl) |
593 | { | 593 | { |
594 | free(dl->line); | 594 | zfree(&dl->line); |
595 | free(dl->name); | 595 | zfree(&dl->name); |
596 | if (dl->ins && dl->ins->ops->free) | 596 | if (dl->ins && dl->ins->ops->free) |
597 | dl->ins->ops->free(&dl->ops); | 597 | dl->ins->ops->free(&dl->ops); |
598 | else | 598 | else |