Skip to content

Commit

Permalink
Fix test memory leaks
Browse files Browse the repository at this point in the history
  • Loading branch information
ferdnyc committed Apr 9, 2021
1 parent 96e165a commit 893a7c4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions tests/DummyReader.cpp
Expand Up @@ -110,6 +110,8 @@ TEST_CASE( "Fake_Frame", "[libopenshot][dummyreader]" ) {

// Add test frame to dummy reader
cache.Add(f);

delete[] audio_buffer;
}

// Create a default fraction (should be 1/1)
Expand Down
8 changes: 6 additions & 2 deletions tests/FrameMapper.cpp
Expand Up @@ -238,7 +238,7 @@ TEST_CASE( "resample_audio_mapper", "[libopenshot][framemapper]" ) {
// Create blank frame (with specific frame #, samples, and channels)
// Sample count should be 44100 / 30 fps = 1470 samples per frame
int sample_count = 1470;
std::shared_ptr<openshot::Frame> f(new openshot::Frame(frame_number, sample_count, 2));
auto f = std::make_shared<openshot::Frame>(frame_number, sample_count, 2);

// Create test samples with sin wave (predictable values)
float *audio_buffer = new float[sample_count * 2];
Expand All @@ -256,6 +256,8 @@ TEST_CASE( "resample_audio_mapper", "[libopenshot][framemapper]" ) {

// Add test frame to dummy reader
cache.Add(f);

delete[] audio_buffer;
}

// Create a default fraction (should be 1/1)
Expand Down Expand Up @@ -377,7 +379,7 @@ TEST_CASE( "redistribute_samples_per_frame", "[libopenshot][framemapper]" ) {
// Create blank frame (with specific frame #, samples, and channels)
// Sample count should be 44100 / 30 fps = 1470 samples per frame
int sample_count = 1470;
std::shared_ptr<openshot::Frame> f(new openshot::Frame(frame_number, sample_count, 2));
auto f = std::make_shared<openshot::Frame>(frame_number, sample_count, 2);

// Create test samples with incrementing value
float *audio_buffer = new float[sample_count];
Expand All @@ -394,6 +396,8 @@ TEST_CASE( "redistribute_samples_per_frame", "[libopenshot][framemapper]" ) {

// Add test frame to dummy reader
cache.Add(f);

delete[] audio_buffer;
}

// Create a default fraction (should be 1/1)
Expand Down

0 comments on commit 893a7c4

Please sign in to comment.