avutil/hwcontext: verify hw_frames_ctx in transfer_data_alloc

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
pull/388/head
Zhao Zhili 2 years ago
parent 0ff18a7d6d
commit b7a3f16957
  1. 6
      libavutil/hwcontext.c

@ -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);

Loading…
Cancel
Save