diff mbox series

[FFmpeg-devel,v2,2/8] avfilter/dnn_backend_openvino: fix multiple memleaks

Message ID tencent_D9704B8F661550BBA6C6E7D52A9E53225C06@qq.com
State Accepted
Commit 5369548f2e55f7c90969c038f4066a2924168d6d
Headers show
Series [FFmpeg-devel,v2,1/8] avfilter/dnn_filter_common: fix memleak | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Zhao Zhili Sept. 2, 2023, 8:23 a.m. UTC
From: Zhao Zhili <zhilizhao@tencent.com>

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
---
 libavfilter/dnn/dnn_backend_openvino.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libavfilter/dnn/dnn_backend_openvino.c b/libavfilter/dnn/dnn_backend_openvino.c
index 4922833b07..951f179b7c 100644
--- a/libavfilter/dnn/dnn_backend_openvino.c
+++ b/libavfilter/dnn/dnn_backend_openvino.c
@@ -68,12 +68,12 @@  typedef struct OVModel{
     ie_core_t *core;
     ie_network_t *network;
     ie_executable_network_t *exe_network;
+    const char *all_input_names;
+    const char *all_output_names;
 #endif
     SafeQueue *request_queue;   // holds OVRequestItem
     Queue *task_queue;          // holds TaskItem
     Queue *lltask_queue;     // holds LastLevelTaskItem
-    const char *all_input_names;
-    const char *all_output_names;
 } OVModel;
 
 // one request for one call to openvino
@@ -508,7 +508,10 @@  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);
 #endif
+        av_opt_free(&ov_model->ctx);
         av_freep(&ov_model);
         av_freep(model);
     }
@@ -1255,6 +1258,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) {
@@ -1268,6 +1272,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);
     }
 #endif