libtracefs: Prevent a memory leak in tracefs_system_events()

If add_list_string() fails, event isn't freed. Free event before
calling add_list_string();

Fixes a RESSOURCE_LEAK error (CWE-772)

Link: https://lore.kernel.org/linux-trace-devel/20240606153830.2666120-9-jmarchan@redhat.com

Fixes: 056a177e1d686 ("libtracefs: Restructure how string lists work")
Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
1 file changed