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

libavformat/audiointerleave.c

index e49c77fe0b1c1a3165e459ad84e485877b7d1dde..ba78d4e9884ce4892626c1d1ae797019b7373f96 100644 (file)
@@ -75,12 +75,14 @@ static int interleave_new_audio_packet(AVFormatContext *s, AVPacket *pkt,
 {
     AVStream *st = s->streams[stream_index];
     AudioInterleaveContext *aic = st->priv_data;
-
+    int ret;
     int size = FFMIN(av_fifo_size(aic->fifo), *aic->samples * aic->sample_size);
     if (!size || (!flush && size == av_fifo_size(aic->fifo)))
         return 0;
 
-    av_new_packet(pkt, size);
+    ret = av_new_packet(pkt, size);
+    if (ret < 0)
+        return ret;
     av_fifo_generic_read(aic->fifo, pkt->data, size, NULL);
 
     pkt->dts = pkt->pts = aic->dts;