aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDerek Buitenhuis <derek.buitenhuis@gmail.com>2017-11-24 19:24:41 +0000
committerDerek Buitenhuis <derek.buitenhuis@gmail.com>2017-11-26 17:26:59 +0000
commite7af1394ecd0e7c237db34ee9c149afff37641dd (patch)
treeb9e3977cccd81458bd6f74d633aa0e59c41e4f63
parent37c57df18e7c46436fa791abf40f4c3031ab56f4 (diff)
downloadffmpeg-e7af1394ecd0e7c237db34ee9c149afff37641dd.tar.gz
vorbisenc: Check the return value of av_frame_clone
Prevents a segfault when alloc fails. Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
-rw-r--r--libavcodec/vorbisenc.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libavcodec/vorbisenc.c b/libavcodec/vorbisenc.c
index a4ecd8f754..18a679f2dc 100644
--- a/libavcodec/vorbisenc.c
+++ b/libavcodec/vorbisenc.c
@@ -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;