Commit 77578d41 authored by Roman Donchenko's avatar Roman Donchenko

Fix a memory leak in CvCapture_FFMPEG::close

FFmpeg now requires that frames allocated with avcodec_alloc_frame are
freed with avcodec_free_frame.
parent 9a62173a
...@@ -300,7 +300,15 @@ void CvCapture_FFMPEG::close() ...@@ -300,7 +300,15 @@ void CvCapture_FFMPEG::close()
} }
if( picture ) if( picture )
{
// FFmpeg and Libav added avcodec_free_frame in different versions.
#if LIBAVCODEC_BUILD >= (LIBAVCODEC_VERSION_MICRO >= 100 \
? CALC_FFMPEG_VERSION(54, 59, 100) : CALC_FFMPEG_VERSION(54, 28, 0))
avcodec_free_frame(&picture);
#else
av_free(picture); av_free(picture);
#endif
}
if( video_st ) if( video_st )
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment