Prevent rule_result from leaking on error.

Change falco_engine::process_event to return a unique_ptr that wraps the
rule result, so it won't be leaked if this method throws an exception.

This means that callers don't need to create their own.
This commit is contained in:
Mark Stemm
2016-12-01 09:29:17 -08:00
parent 8b116c2ad1
commit 0ee32178b7
3 changed files with 6 additions and 7 deletions

View File

@@ -63,7 +63,7 @@ public:
// the rule that matched. If no rule matched, returns NULL.
//
// the reutrned rule_result is allocated and must be delete()d.
rule_result *process_event(sinsp_evt *ev);
std::unique_ptr<rule_result> process_event(sinsp_evt *ev);
//
// Print details on the given rule. If rule is NULL, print