[FFmpeg-cvslog] lavc/videotoolboxenc: Handle out-of-memory and fix memory leak

Rick Kern git at videolan.org
Wed May 4 18:41:28 CEST 2016


ffmpeg | branch: master | Rick Kern <kernrj at gmail.com> | Wed Apr 27 10:53:10 2016 -0400| [272dd437bc6b663200bc6d2c013b02c9eaf64a49] | committer: wm4

lavc/videotoolboxenc: Handle out-of-memory and fix memory leak

Signed-off-by: Rick Kern <kernrj at gmail.com>

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

 libavcodec/videotoolboxenc.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
index 72c7ba8..f53015a 100644
--- a/libavcodec/videotoolboxenc.c
+++ b/libavcodec/videotoolboxenc.c
@@ -706,9 +706,14 @@ static av_cold int vtenc_init(AVCodecContext *avctx)
         CFNumberRef interval = CFNumberCreate(kCFAllocatorDefault,
                                               kCFNumberIntType,
                                               &avctx->gop_size);
+        if (!interval) {
+            return AVERROR(ENOMEM);
+        }
+
         status = VTSessionSetProperty(vtctx->session,
                                       kVTCompressionPropertyKey_MaxKeyFrameInterval,
                                       interval);
+        CFRelease(interval);
 
         if (status) {
             av_log(avctx, AV_LOG_ERROR, "Error setting 'max key-frame interval' property: %d\n", status);



More information about the ffmpeg-cvslog mailing list