We must handle the case when the "tep_event" object is not found. Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@xxxxxxxxx> --- src/event-parse.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/event-parse.c b/src/event-parse.c index de28b3b..d3f1bba 100644 --- a/src/event-parse.c +++ b/src/event-parse.c @@ -6418,17 +6418,21 @@ void tep_print_event(struct tep_handle *tep, struct trace_seq *s, struct tep_record *record, const char *fmt, ...) { struct print_event_type type; - char *format = strdup(fmt); - char *current = format; - char *str = format; + char *format, *current, *str; int offset; va_list args; struct tep_event *event; + event = tep_find_event_by_record(tep, record); + if (!event) { + trace_seq_printf(s, "[UNKNOWN EVENT]"); + return; + } + + str = current = format = strdup(fmt); if (!format) return; - event = tep_find_event_by_record(tep, record); va_start(args, fmt); while (*current) { current = strchr(str, '%'); -- 2.27.0