nutdec: check av_new_packet return value
authorVittorio Giovara <vittorio.giovara@gmail.com>
Mon, 20 Oct 2014 13:11:19 +0000 (14:11 +0100)
committerVittorio Giovara <vittorio.giovara@gmail.com>
Mon, 12 Jan 2015 23:01:33 +0000 (00:01 +0100)
CC: libav-stable@libav.org
Bug-Id: CID 733713

libavformat/nutdec.c

index 6c95d55..36ca754 100644 (file)
@@ -822,7 +822,7 @@ static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code)
 {
     AVFormatContext *s = nut->avf;
     AVIOContext *bc    = s->pb;
-    int size, stream_id, discard;
+    int size, stream_id, discard, ret;
     int64_t pts, last_IP_pts;
     StreamContext *stc;
     uint8_t header_idx;
@@ -847,7 +847,9 @@ static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code)
         return 1;
     }
 
-    av_new_packet(pkt, size + nut->header_len[header_idx]);
+    ret = av_new_packet(pkt, size + nut->header_len[header_idx]);
+    if (ret < 0)
+        return ret;
     memcpy(pkt->data, nut->header[header_idx], nut->header_len[header_idx]);
     pkt->pos = avio_tell(bc); // FIXME
     avio_read(bc, pkt->data + nut->header_len[header_idx], size);