You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
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>
This commit is contained in:
committed by
Guo Yejun
parent
c866a099b2
commit
429954822c
@@ -432,6 +432,8 @@ static DNNReturnType execute_model_ov(RequestItem *request, Queue *inferenceq)
|
|||||||
OVModel *ov_model;
|
OVModel *ov_model;
|
||||||
|
|
||||||
if (ff_queue_size(inferenceq) == 0) {
|
if (ff_queue_size(inferenceq) == 0) {
|
||||||
|
ie_infer_request_free(&request->infer_request);
|
||||||
|
av_freep(&request);
|
||||||
return DNN_SUCCESS;
|
return DNN_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -443,7 +445,7 @@ static DNNReturnType execute_model_ov(RequestItem *request, Queue *inferenceq)
|
|||||||
if (task->async) {
|
if (task->async) {
|
||||||
ret = fill_model_input_ov(ov_model, request);
|
ret = fill_model_input_ov(ov_model, request);
|
||||||
if (ret != DNN_SUCCESS) {
|
if (ret != DNN_SUCCESS) {
|
||||||
return ret;
|
goto err;
|
||||||
}
|
}
|
||||||
status = ie_infer_set_completion_callback(request->infer_request, &request->callback);
|
status = ie_infer_set_completion_callback(request->infer_request, &request->callback);
|
||||||
if (status != OK) {
|
if (status != OK) {
|
||||||
@@ -459,7 +461,7 @@ static DNNReturnType execute_model_ov(RequestItem *request, Queue *inferenceq)
|
|||||||
} else {
|
} else {
|
||||||
ret = fill_model_input_ov(ov_model, request);
|
ret = fill_model_input_ov(ov_model, request);
|
||||||
if (ret != DNN_SUCCESS) {
|
if (ret != DNN_SUCCESS) {
|
||||||
return ret;
|
goto err;
|
||||||
}
|
}
|
||||||
status = ie_infer_request_infer(request->infer_request);
|
status = ie_infer_request_infer(request->infer_request);
|
||||||
if (status != OK) {
|
if (status != OK) {
|
||||||
|
Reference in New Issue
Block a user