FFmpeg: Fix some small memory leaks
Vicki Pfau vi@endrift.com
Fri, 10 Jul 2020 01:22:44 -0700
2 files changed,
10 insertions(+),
0 deletions(-)
M
CHANGES
→
CHANGES
@@ -31,6 +31,7 @@ - All: Improve export headers (fixes mgba.io/i/1738)
- 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)
M
src/feature/ffmpeg/ffmpeg-encoder.c
→
src/feature/ffmpeg/ffmpeg-encoder.c
@@ -546,8 +546,12 @@ avcodec_free_frame(&encoder->audioFrame);
#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 @@ #endif
} if (encoder->videoFrame) { + av_freep(encoder->videoFrame->data); #if LIBAVCODEC_VERSION_MAJOR >= 55 av_frame_free(&encoder->videoFrame); #else@@ -586,8 +591,12 @@ encoder->sinkFrame = NULL;
} if (encoder->video) { +#ifdef FFMPEG_USE_CODECPAR + avcodec_free_context(&encoder->video); +#else avcodec_close(encoder->video); encoder->video = NULL; +#endif } if (encoder->scaleContext) {