* [PATCH v2] libtraceevent: Fix bug in tep_print_event()
@ 2021-06-30 19:37 Yordan Karadzhov (VMware)
0 siblings, 0 replies; only message in thread
From: Yordan Karadzhov (VMware) @ 2021-06-30 19:37 UTC (permalink / raw)
To: rostedt; +Cc: linux-trace-devel, Yordan Karadzhov (VMware)
We must handle the case when the "tep_event" object is not found.
Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
---
src/event-parse.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/src/event-parse.c b/src/event-parse.c
index de28b3b..f42ae38 100644
--- a/src/event-parse.c
+++ b/src/event-parse.c
@@ -6418,17 +6418,23 @@ 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;
+ struct tep_event *event;
+ char *current;
+ char *format;
+ char *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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2021-06-30 19:37 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-30 19:37 [PATCH v2] libtraceevent: Fix bug in tep_print_event() Yordan Karadzhov (VMware)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).