[FFmpeg-cvslog] vorbisenc: Check the return value of av_frame_clone

Derek Buitenhuis git at videolan.org
Sun Nov 26 19:27:31 EET 2017


ffmpeg | branch: master | Derek Buitenhuis <derek.buitenhuis at gmail.com> | Fri Nov 24 19:24:41 2017 +0000| [e7af1394ecd0e7c237db34ee9c149afff37641dd] | committer: Derek Buitenhuis

vorbisenc: Check the return value of av_frame_clone

Prevents a segfault when alloc fails.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e7af1394ecd0e7c237db34ee9c149afff37641dd
---

 libavcodec/vorbisenc.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

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;



More information about the ffmpeg-cvslog mailing list