diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/lib/traceevent/event-parse.c | 8 | ||||
-rw-r--r-- | tools/perf/builtin-test.c | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c index 17c922145e88..47264b4652b9 100644 --- a/tools/lib/traceevent/event-parse.c +++ b/tools/lib/traceevent/event-parse.c @@ -5044,8 +5044,10 @@ enum pevent_errno pevent_parse_event(struct pevent *pevent, const char *buf, /* Add pevent to event so that it can be referenced */ event->pevent = pevent; - if (add_event(pevent, event)) + if (add_event(pevent, event)) { + ret = PEVENT_ERRNO__MEM_ALLOC_FAILED; goto event_add_failed; + } #define PRINT_ARGS 0 if (PRINT_ARGS && event->print_fmt.args) @@ -5054,9 +5056,7 @@ enum pevent_errno pevent_parse_event(struct pevent *pevent, const char *buf, return 0; event_add_failed: - free(event->system); - free(event->name); - free(event); + pevent_free_format(event); return ret; } diff --git a/tools/perf/builtin-test.c b/tools/perf/builtin-test.c index 32caf13cfe01..78b47a75a7c9 100644 --- a/tools/perf/builtin-test.c +++ b/tools/perf/builtin-test.c @@ -1233,7 +1233,7 @@ static int perf_evsel__test_field(struct perf_evsel *evsel, const char *name, ret = -1; } - return 0; + return ret; } static int perf_evsel__tp_sched_test(void) @@ -1286,7 +1286,7 @@ static int perf_evsel__tp_sched_test(void) if (perf_evsel__test_field(evsel, "target_cpu", 4, true)) ret = -1; - return 0; + return ret; } static struct test { |