avutil/hwcontext: verify hw_frames_ctx in transfer_data_alloc

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
This commit is contained in:
Zhao Zhili 2022-10-22 05:29:35 +00:00
parent 0ff18a7d6d
commit b7a3f16957

View File

@ -397,10 +397,14 @@ int av_hwframe_transfer_get_formats(AVBufferRef *hwframe_ref,
static int transfer_data_alloc(AVFrame *dst, const AVFrame *src, int flags)
{
AVHWFramesContext *ctx = (AVHWFramesContext*)src->hw_frames_ctx->data;
AVHWFramesContext *ctx;
AVFrame *frame_tmp;
int ret = 0;
if (!src->hw_frames_ctx)
return AVERROR(EINVAL);
ctx = (AVHWFramesContext*)src->hw_frames_ctx->data;
frame_tmp = av_frame_alloc();
if (!frame_tmp)
return AVERROR(ENOMEM);