[FFmpeg-devel] [PATCH 5/9] wtvenc: Add missing error check

Mark Thompson sw at jkqxz.net
Wed Oct 18 00:12:21 EEST 2017


---
 libavformat/wtvenc.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavformat/wtvenc.c b/libavformat/wtvenc.c
index 4a68b8133f..d4a08dda61 100644
--- a/libavformat/wtvenc.c
+++ b/libavformat/wtvenc.c
@@ -462,12 +462,15 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
     AVIOContext *pb = s->pb;
     WtvContext  *wctx = s->priv_data;
     AVStream    *st   = s->streams[pkt->stream_index];
+    int ret;
 
     if (st->codecpar->codec_id == AV_CODEC_ID_MJPEG && !wctx->thumbnail.size) {
-        av_packet_ref(&wctx->thumbnail, pkt);
+        ret = av_packet_ref(&wctx->thumbnail, pkt);
+        if (ret < 0)
+            return ret;
         return 0;
     } else if (st->codecpar->codec_id == AV_CODEC_ID_H264) {
-        int ret = ff_check_h264_startcode(s, st, pkt);
+        ret = ff_check_h264_startcode(s, st, pkt);
         if (ret < 0)
             return ret;
     }
-- 
2.11.0



More information about the ffmpeg-devel mailing list