Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Memory leaks in FFmpegReader, Clip, and FrameMapper #909

Merged
merged 2 commits into from
Mar 20, 2023

Conversation

jonoomph
Copy link
Member

Due to a recent regression, and some investigating into memory leaks (thanks to Valgrind), we found and fixed 3 serious memory leaks in libopenshot.

  • AVFRAME in FFmpegReader::ProcessVideoPacket - initializing struct, but not deleting it if the packet was not ready
  • AVFRAME in FFmpegReader::ProcessAudioPacket - initializing struct, but not deleting it if the packet was not ready
  • Clip::final_cache was not being initialized correctly, and was defaulting to infinite Clip cache - always growing as large as the # of frames in the clip - oops - large leak

…Clip cache on accident - causing a large memory leak. Also fixing a small logic regression in FrameMapper, designed to skip audio sample re-distribution, if all settings are the same as the source file.
@jonoomph
Copy link
Member Author

@codecov
Copy link

codecov bot commented Mar 20, 2023

Codecov Report

Merging #909 (59e0862) into develop (ec0c0b1) will increase coverage by 0.05%.
The diff coverage is 100.00%.

@@             Coverage Diff             @@
##           develop     #909      +/-   ##
===========================================
+ Coverage    54.03%   54.09%   +0.05%     
===========================================
  Files          191      191              
  Lines        16842    16845       +3     
===========================================
+ Hits          9101     9112      +11     
+ Misses        7741     7733       -8     
Impacted Files Coverage Δ
src/Clip.cpp 69.82% <100.00%> (ø)
src/FFmpegReader.cpp 74.47% <100.00%> (+0.04%) ⬆️
src/FrameMapper.cpp 92.17% <100.00%> (+1.36%) ⬆️

... and 1 file with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@jonoomph jonoomph merged commit f0b44c5 into develop Mar 20, 2023
@jonoomph jonoomph deleted the memory-leak-mar-20-2023 branch March 20, 2023 22:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant