Skip to content

Commit

Permalink
fix: memory leak in run_parse_and_verify_test
Browse files Browse the repository at this point in the history
In order to simulate enough of the parse dispatch loop to get the flatbuffer_parser to read multiple examples, we need to "dispatch" the examples after each pass through the parser, othrwise it is going to attempt to write in place over a single example.

When dispatching was introduced in the tests, it was used to swallow an extraneous newline example (which is used and swallowed internally by the example dispatcher to collect examples into multi_ex for, e.g. cb_adf), and without cleanup it leaks.
  • Loading branch information
lokitoth committed Feb 6, 2024
1 parent f7496ba commit 183a760
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions vowpalwabbit/fb_parser/tests/flatbuffer_parser_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ void run_parse_and_verify_test(VW::workspace& w, const root_prototype_t& root_ob
{
case VW::experimental::error_code::success:
if (!w.l->is_multiline() || !dispatch_examples[0]->is_newline) { examples.push_back(dispatch_examples[0]); }
else { VW::finish_example(w, dispatch_examples[0]); }

break;
case VW::experimental::error_code::nothing_to_parse:
Expand Down

0 comments on commit 183a760

Please sign in to comment.