[FFmpeg-cvslog] lavfi/dnn_backend_openvino.c: fix mem leak for RequestItem upon error

Guo, Yejun git at videolan.org
Thu Mar 18 03:56:02 EET 2021


ffmpeg | branch: master | Guo, Yejun <yejun.guo at intel.com> | Sat Mar 13 14:09:33 2021 +0800| [df59ae8bb21b596125eccaab7d7984d03dd9ab45] | committer: Guo, Yejun

lavfi/dnn_backend_openvino.c: fix mem leak for RequestItem upon error

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=df59ae8bb21b596125eccaab7d7984d03dd9ab45
---

 libavfilter/dnn/dnn_backend_openvino.c | 16 +++++++---------
 1 file 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();



More information about the ffmpeg-cvslog mailing list