only call avformat_close_input if mformatContext still has a value. On falure it should have been freed and NULL'd

pull/2077/head
Isaac 2018-04-06 23:02:15 +02:00
parent ae3ccf6ffe
commit d8171750cd
1 changed files with 4 additions and 2 deletions

View File

@ -362,9 +362,11 @@ int FfmpegCamera::OpenFfmpeg() {
#if !LIBAVFORMAT_VERSION_CHECK(53, 17, 0, 25, 0)
av_close_input_file( mFormatContext );
#else
avformat_close_input( &mFormatContext );
if ( mFormatContext ) {
avformat_close_input( &mFormatContext );
mFormatContext = NULL;
}
#endif
mFormatContext = NULL;
av_dict_free(&opts);
return -1;