1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

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

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;