[FFmpeg-devel] [PATCH] qsvenc: avoid dereferencing the null pointer
Xiang, Haihao
haihao.xiang at intel.com
Mon Feb 28 08:39:52 EET 2022
On Thu, 2022-02-24 at 10:27 +0800, Tong Wu wrote:
> The variable AVFrame *frame could be a null pointer, now add a null
> pointer check to avoid dereferencing the null pointer.
>
> Signed-off-by: Tong Wu <tong1.wu 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 07be4287b7..998e43753e 100644
> --- a/libavcodec/qsvenc.c
> +++ b/libavcodec/qsvenc.c
> @@ -1726,7 +1726,7 @@ static int encode_frame(AVCodecContext *avctx,
> QSVEncContext *q,
> goto free;
> }
>
> - if (ret == MFX_WRN_INCOMPATIBLE_VIDEO_PARAM && frame->interlaced_frame)
> + if (ret == MFX_WRN_INCOMPATIBLE_VIDEO_PARAM && frame && frame-
> >interlaced_frame)
> print_interlace_msg(avctx, q);
>
> ret = 0;
LGTM, applied
-Haihao
More information about the ffmpeg-devel
mailing list