Skip to content

Commit

Permalink
fix(tests): remove a possible memleak from tests
Browse files Browse the repository at this point in the history
Signed-off-by: Andrea Terzolo <[email protected]>
  • Loading branch information
Andreagit97 committed Nov 16, 2023
1 parent 058aedd commit ed3e2b0
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion userspace/libsinsp/test/sinsp_with_test_input.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit ed3e2b0

Please sign in to comment.