mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-13 21:28:01 +02:00
libavfilter/dnn_backend_native: check mem allocation
check that frame allocations return non-null.
This commit is contained in:
parent
00772ef4f7
commit
ad95e5e45d
@ -79,8 +79,23 @@ static DNNReturnType get_output_native(void *model, const char *input_name, int
|
|||||||
{
|
{
|
||||||
DNNReturnType ret;
|
DNNReturnType ret;
|
||||||
NativeModel *native_model = (NativeModel *)model;
|
NativeModel *native_model = (NativeModel *)model;
|
||||||
|
NativeContext *ctx = &native_model->ctx;
|
||||||
AVFrame *in_frame = av_frame_alloc();
|
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, "Could not allocate memory for input frame\n");
|
||||||
|
return DNN_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
out_frame = av_frame_alloc();
|
||||||
|
|
||||||
|
if (!out_frame) {
|
||||||
|
av_log(ctx, AV_LOG_ERROR, "Could not allocate memory for output frame\n");
|
||||||
|
av_frame_free(&in_frame);
|
||||||
|
return DNN_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
in_frame->width = input_width;
|
in_frame->width = input_width;
|
||||||
in_frame->height = input_height;
|
in_frame->height = input_height;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user