Fix a memory leak in CvCapture_FFMPEG::close

FFmpeg now requires that frames allocated with avcodec_alloc_frame are
freed with avcodec_free_frame.

(cherry picked from commit 77578d415f)

Conflicts:
	modules/highgui/src/cap_ffmpeg_impl.hpp
pull/3817/head
Roman Donchenko 10 years ago
parent 1858b5cfba
commit 34ad2e0fa4
  1. 8
      modules/videoio/src/cap_ffmpeg_impl.hpp

@ -302,7 +302,15 @@ void CvCapture_FFMPEG::close()
}
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);
#endif
}
if( video_st )
{

Loading…
Cancel
Save