diff options
author | Rick Kern <kernrj@gmail.com> | 2016-04-27 10:53:10 -0400 |
---|---|---|
committer | wm4 <nfxjfg@googlemail.com> | 2016-05-04 18:40:40 +0200 |
commit | 272dd437bc6b663200bc6d2c013b02c9eaf64a49 (patch) | |
tree | b6eff5c10c6702e3ce5bf3891730dd7793590e7f | |
parent | 2fbf39382dbf38e7cfdd2b106da66ca2f5af307d (diff) | |
download | ffmpeg-272dd437bc6b663200bc6d2c013b02c9eaf64a49.tar.gz |
lavc/videotoolboxenc: Handle out-of-memory and fix memory leak
Signed-off-by: Rick Kern <kernrj@gmail.com>
-rw-r--r-- | libavcodec/videotoolboxenc.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c index 72c7ba8994..f53015ac9c 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); |