diff options
author | Paul B Mahol <onemda@gmail.com> | 2012-10-15 19:11:54 +0400 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2012-10-15 21:03:41 +0400 |
commit | 3ca8a2328878ebdb203e49d0a060df1b5337a370 (patch) | |
tree | e9f82a1c55d8e62da599058510ccc787f18fb812 | |
parent | bb502411ddb9fe1928d4a999693a3a49b83f8698 (diff) |
lavf/audiointerleave: check return value of av_new_packet()
Fixes CID733709.
Signed-off-by: Paul B Mahol <onemda@gmail.com>
-rw-r--r-- | libavformat/audiointerleave.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libavformat/audiointerleave.c b/libavformat/audiointerleave.c index 609a5117a3..20323a2c58 100644 --- a/libavformat/audiointerleave.c +++ b/libavformat/audiointerleave.c @@ -84,7 +84,8 @@ static int ff_interleave_new_audio_packet(AVFormatContext *s, AVPacket *pkt, if (!size || (!flush && size == av_fifo_size(aic->fifo))) return 0; - av_new_packet(pkt, size); + if (av_new_packet(pkt, size) < 0) + return AVERROR(ENOMEM); av_fifo_generic_read(aic->fifo, pkt->data, size, NULL); pkt->dts = pkt->pts = aic->dts; @@ -133,11 +134,13 @@ int ff_audio_rechunk_interleave(AVFormatContext *s, AVPacket *out, AVPacket *pkt if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) { AVPacket new_pkt; int ret; - while (ff_interleave_new_audio_packet(s, &new_pkt, i, flush)) { + while ((ret = ff_interleave_new_audio_packet(s, &new_pkt, i, flush)) > 0) { ret = ff_interleave_add_packet(s, &new_pkt, compare_ts); if (ret < 0) return ret; } + if (ret < 0) + return ret; } } |