aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShubhanshu Saxena <shubhanshu.e01@gmail.com>2021-07-11 21:45:01 +0530
committerGuo Yejun <yejun.guo@intel.com>2021-07-22 08:13:14 +0800
commit429954822cd8a74f3ab73f4abe870cf8ef53389b (patch)
treeaaf2bf7d3451843be5bd5c62113a0d78d72f22d9
parentc866a099b297203306165be3c444d481fcb22553 (diff)
downloadffmpeg-429954822cd8a74f3ab73f4abe870cf8ef53389b.tar.gz
lavfi/dnn_backend_openvino.c: Fix Memory Leak in execute_model_ov
In cases where the execution inside the function execute_model_ov fails, the OVRequestItem must be pushed back to the request_queue before returning the error. In case pushing back fails, release the allocated memory. Signed-off-by: Shubhanshu Saxena <shubhanshu.e01@gmail.com>
-rw-r--r--libavfilter/dnn/dnn_backend_openvino.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavfilter/dnn/dnn_backend_openvino.c b/libavfilter/dnn/dnn_backend_openvino.c
index f34b8150f5..b340859c12 100644
--- a/libavfilter/dnn/dnn_backend_openvino.c
+++ b/libavfilter/dnn/dnn_backend_openvino.c
@@ -432,6 +432,8 @@ static DNNReturnType execute_model_ov(RequestItem *request, Queue *inferenceq)
OVModel *ov_model;
if (ff_queue_size(inferenceq) == 0) {
+ ie_infer_request_free(&request->infer_request);
+ av_freep(&request);
return DNN_SUCCESS;
}
@@ -443,7 +445,7 @@ static DNNReturnType execute_model_ov(RequestItem *request, Queue *inferenceq)
if (task->async) {
ret = fill_model_input_ov(ov_model, request);
if (ret != DNN_SUCCESS) {
- return ret;
+ goto err;
}
status = ie_infer_set_completion_callback(request->infer_request, &request->callback);
if (status != OK) {
@@ -459,7 +461,7 @@ static DNNReturnType execute_model_ov(RequestItem *request, Queue *inferenceq)
} else {
ret = fill_model_input_ov(ov_model, request);
if (ret != DNN_SUCCESS) {
- return ret;
+ goto err;
}
status = ie_infer_request_infer(request->infer_request);
if (status != OK) {