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

Submitted by Mark Thompson on Oct. 17, 2017, 9:12 p.m.

Details

Message ID 20171017211225.3175-5-sw@jkqxz.net
State New
Headers show

Commit Message

Mark Thompson Oct. 17, 2017, 9:12 p.m.
---
 libavformat/wtvenc.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

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;
     }