[FFmpeg-devel] [PATCH 1/3] vaapi_encode: Initialize the pointer

Haihao Xiang haihao.xiang at intel.com
Fri May 4 17:41:05 EEST 2018


Otherwise it might use unitialized last_pic in av_assert0(last_pic)

Signed-off-by: Haihao Xiang <haihao.xiang at intel.com>
---
 libavcodec/vaapi_encode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
index 36c85a3815..141e50c8ad 100644
--- a/libavcodec/vaapi_encode.c
+++ b/libavcodec/vaapi_encode.c
@@ -760,7 +760,7 @@ fail:
 static int vaapi_encode_truncate_gop(AVCodecContext *avctx)
 {
     VAAPIEncodeContext *ctx = avctx->priv_data;
-    VAAPIEncodePicture *pic, *last_pic, *next;
+    VAAPIEncodePicture *pic, *last_pic = NULL, *next;
 
     // Find the last picture we actually have input for.
     for (pic = ctx->pic_start; pic; pic = pic->next) {
-- 
2.17.0



More information about the ffmpeg-devel mailing list