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

This commit is contained in:
Isaac committed 2018-04-06 23:02:15 +02:00
1 parent ae3ccf6ffe
commit d8171750cd
1 file changed
+4 -2
+4 -2
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;