vorbisenc: Check the return value of av_frame_clone

Prevents a segfault when alloc fails.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
This commit is contained in:
Derek Buitenhuis 2017-11-24 19:24:41 +00:00
parent 37c57df18e
commit e7af1394ec
1 changed files with 5 additions and 1 deletions

View File

@ -1093,9 +1093,13 @@ static int vorbis_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
PutBitContext pb;
if (frame) {
AVFrame *clone;
if ((ret = ff_af_queue_add(&venc->afq, frame)) < 0)
return ret;
ff_bufqueue_add(avctx, &venc->bufqueue, av_frame_clone(frame));
clone = av_frame_clone(frame);
if (!clone)
return AVERROR(ENOMEM);
ff_bufqueue_add(avctx, &venc->bufqueue, clone);
} else
if (!venc->afq.remaining_samples)
return 0;