aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuo, Yejun <yejun.guo@intel.com>2021-03-13 14:09:33 +0800
committerGuo, Yejun <yejun.guo@intel.com>2021-03-18 09:30:09 +0800
commitdf59ae8bb21b596125eccaab7d7984d03dd9ab45 (patch)
treef1f165367932706320d3b5f6452843f585429d5f
parent41f4af16fc00105e570f3f550b4ddba5cabab643 (diff)
downloadffmpeg-df59ae8bb21b596125eccaab7d7984d03dd9ab45.tar.gz
lavfi/dnn_backend_openvino.c: fix mem leak for RequestItem upon error
-rw-r--r--libavfilter/dnn/dnn_backend_openvino.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/libavfilter/dnn/dnn_backend_openvino.c b/libavfilter/dnn/dnn_backend_openvino.c
index 50de6a996e..55cb0c757e 100644
--- a/libavfilter/dnn/dnn_backend_openvino.c
+++ b/libavfilter/dnn/dnn_backend_openvino.c
@@ -353,25 +353,23 @@ static DNNReturnType init_model_ov(OVModel *ov_model, const char *input_name, co
goto err;
}
+ item->callback.completeCallBackFunc = infer_completion_callback;
+ item->callback.args = item;
+ if (ff_safe_queue_push_back(ov_model->request_queue, item) < 0) {
+ av_freep(&item);
+ goto err;
+ }
+
status = ie_exec_network_create_infer_request(ov_model->exe_network, &item->infer_request);
if (status != OK) {
- av_freep(&item);
goto err;
}
item->tasks = av_malloc_array(ctx->options.batch_size, sizeof(*item->tasks));
if (!item->tasks) {
- av_freep(&item);
goto err;
}
item->task_count = 0;
-
- item->callback.completeCallBackFunc = infer_completion_callback;
- item->callback.args = item;
- if (ff_safe_queue_push_back(ov_model->request_queue, item) < 0) {
- av_freep(&item);
- goto err;
- }
}
ov_model->task_queue = ff_queue_create();