[FFmpeg-devel] [PATCH 2/3] avfilter/dnn_backend_openvino: fix multiple memleaks

Zhao Zhili quinkblack at foxmail.com
Fri Aug 18 20:52:31 EEST 2023


From: Zhao Zhili <zhilizhao at tencent.com>

Signed-off-by: Zhao Zhili <zhilizhao at tencent.com>
---
 libavfilter/dnn/dnn_backend_openvino.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavfilter/dnn/dnn_backend_openvino.c b/libavfilter/dnn/dnn_backend_openvino.c
index 46cbe8270e..071516b17d 100644
--- a/libavfilter/dnn/dnn_backend_openvino.c
+++ b/libavfilter/dnn/dnn_backend_openvino.c
@@ -326,6 +326,9 @@ static void dnn_free_model_ov(DNNModel **model)
             ie_network_free(&ov_model->network);
         if (ov_model->core)
             ie_core_free(&ov_model->core);
+        av_free(ov_model->all_output_names);
+        av_free(ov_model->all_input_names);
+        av_opt_free(&ov_model->ctx);
         av_freep(&ov_model);
         av_freep(model);
     }
@@ -821,6 +824,7 @@ static DNNModel *dnn_load_model_ov(const char *model_filename, DNNFunctionType f
             goto err;
         }
         APPEND_STRING(ov_model->all_input_names, node_name)
+        ie_network_name_free(&node_name);
     }
     status = ie_network_get_outputs_number(ov_model->network, &node_count);
     if (status != OK) {
@@ -834,6 +838,7 @@ static DNNModel *dnn_load_model_ov(const char *model_filename, DNNFunctionType f
             goto err;
         }
         APPEND_STRING(ov_model->all_output_names, node_name)
+        ie_network_name_free(&node_name);
     }
 
     model->get_input = &get_input_ov;
-- 
2.25.1



More information about the ffmpeg-devel mailing list