avutil/hwcontext: verify hw_frames_ctx in transfer_data_alloc
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
This commit is contained in:
@@ -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)
|
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;
|
AVFrame *frame_tmp;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
|
if (!src->hw_frames_ctx)
|
||||||
|
return AVERROR(EINVAL);
|
||||||
|
ctx = (AVHWFramesContext*)src->hw_frames_ctx->data;
|
||||||
|
|
||||||
frame_tmp = av_frame_alloc();
|
frame_tmp = av_frame_alloc();
|
||||||
if (!frame_tmp)
|
if (!frame_tmp)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
|
Reference in New Issue
Block a user