FFmpeg: Fix some small memory leaks

This commit is contained in:
Vicki Pfau 2020-07-10 01:22:44 -07:00
parent cdf9105f56
commit 145a31868a
2 changed files with 10 additions and 0 deletions

View File

@ -31,6 +31,7 @@ Other fixes:
- All: Correct format strings for some numbers on Windows (fixes mgba.io/i/1794)
- Core: Ensure ELF regions can be written before trying
- Debugger: Don't skip undefined instructions when debugger attached
- FFmpeg: Fix some small memory leaks
- GB Core: Fix extracting SRAM when none is present
- GBA Savedata: Fix extracting save when not yet configured in-game
- Qt: Force OpenGL paint engine creation thread (fixes mgba.io/i/1642)

View File

@ -546,8 +546,12 @@ void FFmpegEncoderClose(struct FFmpegEncoder* encoder) {
#endif
}
if (encoder->audio) {
#ifdef FFMPEG_USE_CODECPAR
avcodec_free_context(&encoder->audio);
#else
avcodec_close(encoder->audio);
encoder->audio = NULL;
#endif
}
if (encoder->resampleContext) {
@ -569,6 +573,7 @@ void FFmpegEncoderClose(struct FFmpegEncoder* encoder) {
}
if (encoder->videoFrame) {
av_freep(encoder->videoFrame->data);
#if LIBAVCODEC_VERSION_MAJOR >= 55
av_frame_free(&encoder->videoFrame);
#else
@ -586,8 +591,12 @@ void FFmpegEncoderClose(struct FFmpegEncoder* encoder) {
}
if (encoder->video) {
#ifdef FFMPEG_USE_CODECPAR
avcodec_free_context(&encoder->video);
#else
avcodec_close(encoder->video);
encoder->video = NULL;
#endif
}
if (encoder->scaleContext) {