diff --git a/userspace/libsinsp/test/sinsp_with_test_input.h b/userspace/libsinsp/test/sinsp_with_test_input.h index d69a6bf8e70..716ef02ae96 100644 --- a/userspace/libsinsp/test/sinsp_with_test_input.h +++ b/userspace/libsinsp/test/sinsp_with_test_input.h @@ -411,7 +411,17 @@ class sinsp_with_test_input : public ::testing::Test { throw sinsp_exception("The event class is NULL"); } - return flist.new_filter_check_from_fldname(field_name, &m_inspector, false) != nullptr; + auto new_fl = flist.new_filter_check_from_fldname(field_name, &m_inspector, false); + if(new_fl != nullptr) + { + // if can create a filter check it means that the field exists + delete new_fl; + return true; + } + else + { + return false; + } } // Return true if `field_name` value is not NULL for this event.