[FFmpeg-devel,2/3] ffmpeg: check return value of avcodec_parameters_from_context

Submitted by Marton Balint on Oct. 7, 2018, 9:02 p.m.

Details

Message ID 20181007210228.16822-2-cus@passwd.hu
State New
Headers show

Commit Message

Marton Balint Oct. 7, 2018, 9:02 p.m.
Fixes Coverity CID 1427273.

Signed-off-by: Marton Balint <cus@passwd.hu>
---
 fftools/ffmpeg.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 934dc71a74..aa495b5d9e 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -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;