ffmpeg: check return value of avcodec_parameters_from_context
authorMarton Balint <cus@passwd.hu>
Sun, 7 Oct 2018 20:16:49 +0000 (22:16 +0200)
committerMarton Balint <cus@passwd.hu>
Tue, 9 Oct 2018 19:46:28 +0000 (21:46 +0200)
Fixes Coverity CID 1427273.

Signed-off-by: Marton Balint <cus@passwd.hu>
fftools/ffmpeg.c

index 934dc71..aa495b5 100644 (file)
@@ -3072,7 +3072,13 @@ static int init_output_stream_streamcopy(OutputStream *ost)
                "Error setting up codec context options.\n");
         return ret;
     }
-    avcodec_parameters_from_context(par_src, ost->enc_ctx);
+
+    ret = avcodec_parameters_from_context(par_src, ost->enc_ctx);
+    if (ret < 0) {
+        av_log(NULL, AV_LOG_FATAL,
+               "Error getting reference codec parameters.\n");
+        return ret;
+    }
 
     if (!codec_tag) {
         unsigned int codec_tag_tmp;