{
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;
{
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;