aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util')
-rw-r--r--tools/perf/util/annotate.c10
-rw-r--r--tools/perf/util/annotate.h4
2 files changed, 10 insertions, 4 deletions
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index a984bdae7811..08e041a9b9cc 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -3206,7 +3206,11 @@ static int annotation__config(const char *var, const char *value, void *data)
} else if (!strcmp(var, "annotate.use_offset")) {
opt->use_offset = perf_config_bool("use_offset", value);
} else if (!strcmp(var, "annotate.disassembler_style")) {
- opt->disassembler_style = value;
+ opt->disassembler_style = strdup(value);
+ if (!opt->disassembler_style) {
+ pr_err("Not enough memory for annotate.disassembler_style\n");
+ return -1;
+ }
} else if (!strcmp(var, "annotate.demangle")) {
symbol_conf.demangle = perf_config_bool("demangle", value);
} else if (!strcmp(var, "annotate.demangle_kernel")) {
@@ -3231,8 +3235,10 @@ void annotation_options__init(struct annotation_options *opt)
}
-void annotation_options__exit(struct annotation_options *opt __maybe_unused)
+void annotation_options__exit(struct annotation_options *opt)
{
+ zfree(&opt->disassembler_style);
+ zfree(&opt->objdump_path);
}
void annotation_config__init(struct annotation_options *opt)
diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h
index e7238c694465..1c6335b8333a 100644
--- a/tools/perf/util/annotate.h
+++ b/tools/perf/util/annotate.h
@@ -94,8 +94,8 @@ struct annotation_options {
int min_pcnt;
int max_lines;
int context;
- const char *objdump_path;
- const char *disassembler_style;
+ char *objdump_path;
+ char *disassembler_style;
const char *prefix;
const char *prefix_strip;
unsigned int percent_type;