Skip to content

Commit

Permalink
Fixed memory leak in test
Browse files Browse the repository at this point in the history
  • Loading branch information
Griezn committed Nov 17, 2024
1 parent 45e8289 commit f2bde32
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions tests/dataTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,16 +173,23 @@ TEST(DataTests, test_file_source_inc)
sink_t *gsink = create_generator_sink();
sink_t *fsink = create_generator_sink();

gsink->push_next(gsink, gsource->get_next(gsource));
fsink->push_next(fsink, fsource->get_next(fsource));
data_t *next_gdata = gsource->get_next(gsource);
data_t *next_fdata = fsource->get_next(fsource);

gsink->push_next(gsink, next_gdata);
fsink->push_next(fsink, next_fdata);

ASSERT_TRUE(ARR_EQ(gsink->buffer.data, fsink->buffer.data, increment));

fsink->push_next(fsink, fsource->get_next(fsource));
free(next_fdata);
next_fdata = fsource->get_next(fsource);
fsink->push_next(fsink, next_fdata);

ASSERT_TRUE(ARR_EQ(gsink->buffer.data + increment, fsink->buffer.data, increment));

fsink->push_next(fsink, fsource->get_next(fsource));
free(next_fdata);
next_fdata = fsource->get_next(fsource);
fsink->push_next(fsink, next_fdata);

ASSERT_TRUE(ARR_EQ(gsink->buffer.data + 2*increment, fsink->buffer.data, increment));

Expand Down

0 comments on commit f2bde32

Please sign in to comment.