mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-01-29 18:53:02 +00:00
libavfilter/dnn/dnn_backend{openvino, tf}: check memory alloc non-NULL
These previously would not check that the return value was non-null meaning it was susceptible to a sigsegv. This checks those values.
This commit is contained in:
parent
ad95e5e45d
commit
6bdfea8d4b
@ -141,8 +141,20 @@ static DNNReturnType get_output_ov(void *model, const char *input_name, int inpu
|
||||
{
|
||||
DNNReturnType ret;
|
||||
OVModel *ov_model = (OVModel *)model;
|
||||
OVContext *ctx = &ov_model->ctx;
|
||||
AVFrame *in_frame = av_frame_alloc();
|
||||
AVFrame *out_frame = av_frame_alloc();
|
||||
AVFrame *out_frame = NULL;
|
||||
|
||||
if (!in_frame) {
|
||||
av_log(ctx, AV_LOG_ERROR, "Failed to allocate memory for input frame\n");
|
||||
return DNN_ERROR;
|
||||
}
|
||||
out_frame = av_frame_alloc();
|
||||
if (!out_frame) {
|
||||
av_log(ctx, AV_LOG_ERROR, "Failed to allocate memory for output frame\n");
|
||||
av_frame_free(&in_frame);
|
||||
return DNN_ERROR;
|
||||
}
|
||||
in_frame->width = input_width;
|
||||
in_frame->height = input_height;
|
||||
|
||||
|
@ -159,8 +159,22 @@ static DNNReturnType get_output_tf(void *model, const char *input_name, int inpu
|
||||
{
|
||||
DNNReturnType ret;
|
||||
TFModel *tf_model = (TFModel *)model;
|
||||
TFContext *ctx = &tf_model->ctx;
|
||||
AVFrame *in_frame = av_frame_alloc();
|
||||
AVFrame *out_frame = av_frame_alloc();
|
||||
AVFrame *out_frame = NULL;
|
||||
|
||||
if (!in_frame) {
|
||||
av_log(ctx, AV_LOG_ERROR, "Failed to allocate memory for input frame\n");
|
||||
return DNN_ERROR;
|
||||
}
|
||||
|
||||
out_frame = av_frame_alloc();
|
||||
if (!out_frame) {
|
||||
av_log(ctx, AV_LOG_ERROR, "Failed to allocate memory for output frame\n");
|
||||
av_frame_free(&in_frame);
|
||||
return DNN_ERROR;
|
||||
}
|
||||
|
||||
in_frame->width = input_width;
|
||||
in_frame->height = input_height;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user