From 4462fee5d3efdf42c91f1b54a61da052423e00b6 Mon Sep 17 00:00:00 2001 From: Federico Di Pierro Date: Mon, 9 Dec 2024 13:19:58 +0100 Subject: [PATCH] fix(userspace/libsinsp): always initialize sinsp_evt with a proper source_idx and source_name. Signed-off-by: Federico Di Pierro --- userspace/libsinsp/event.cpp | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/userspace/libsinsp/event.cpp b/userspace/libsinsp/event.cpp index d65565ff74..4b7370d24f 100644 --- a/userspace/libsinsp/event.cpp +++ b/userspace/libsinsp/event.cpp @@ -79,27 +79,13 @@ sinsp_evt::sinsp_evt(): m_errorcode(0), m_rawbuf_str_len(0), m_filtered_out(false), - m_event_info_table(g_infotables.m_event_info) {} + m_event_info_table(g_infotables.m_event_info), + m_source_idx(sinsp_no_event_source_idx), + m_source_name(NULL) {} -sinsp_evt::sinsp_evt(sinsp *inspector): - m_inspector(inspector), - m_pevt(NULL), - m_pevt_storage(NULL), - m_cpuid(0), - m_evtnum(0), - m_flags(EF_NONE), - m_params_loaded(false), - m_info(NULL), - m_paramstr_storage(1024), - m_resolved_paramstr_storage(1024), - m_tinfo(NULL), - m_fdinfo(NULL), - m_fdinfo_name_changed(false), - m_iosize(0), - m_errorcode(0), - m_rawbuf_str_len(0), - m_filtered_out(false), - m_event_info_table(g_infotables.m_event_info) {} +sinsp_evt::sinsp_evt(sinsp *inspector): sinsp_evt() { + m_inspector = inspector; +} sinsp_evt::~sinsp_evt() { if(m_pevt_storage) {