[FFmpeg-devel] [PATCH 1/2] lavc/qsvenc: Fix the memory leak for enc_ctrl.Payload
Linjie Fu
linjie.fu at intel.com
Wed Apr 10 14:27:14 EEST 2019
frame->enc_ctrl.Payload is malloced in get_free_frame, directly memset
the whole structure of enc_ctrl to zero will cause the memory leak for
enc_ctrl.Payload.
Fix the memory leak issue and reset other members in mfxEncodeCtrl.
Signed-off-by: Linjie Fu <linjie.fu at intel.com>
---
libavcodec/qsvenc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index 5aa020d47b..029bb562d6 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -1254,7 +1254,7 @@ static int encode_frame(AVCodecContext *avctx, QSVEncContext *q,
if (qsv_frame) {
surf = &qsv_frame->surface;
enc_ctrl = &qsv_frame->enc_ctrl;
- memset(enc_ctrl, 0, sizeof(mfxEncodeCtrl));
+ memset(enc_ctrl, 0, sizeof(mfxEncodeCtrl) - sizeof(mfxPayload **));
if (frame->pict_type == AV_PICTURE_TYPE_I) {
enc_ctrl->FrameType = MFX_FRAMETYPE_I | MFX_FRAMETYPE_REF;
--
2.17.1
More information about the ffmpeg-devel
mailing list