[FFmpeg-devel] [PATCH] libavcodec/videotoolboxenc: fix pixel buffer memory leak

13102179620 at 163.com 13102179620 at 163.com
Tue Nov 9 12:51:58 EET 2021


From: songyutong <songyutong at kuaishou.com>

In function vtenc_populate_extradata(), there is a manually created
pixel buffer that has not been released. So we should use CVPixelBufferRelease
to release this pixel buffer at the end, otherwise will cause a memory leak.
---
 libavcodec/videotoolboxenc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
index 8a02d3d1a0..c06b506cc9 100644
--- a/libavcodec/videotoolboxenc.c
+++ b/libavcodec/videotoolboxenc.c
@@ -2548,6 +2548,7 @@ static int vtenc_populate_extradata(AVCodecContext   *avctx,
 
 
 pe_cleanup:
+    CVPixelBufferRelease(pix_buf);
     if(vtctx->session)
         CFRelease(vtctx->session);
 
-- 
2.30.0



More information about the ffmpeg-devel mailing list