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

Guo, Yejun git at videolan.org
Thu Mar 18 03:55:58 EET 2021


ffmpeg | branch: master | Guo, Yejun <yejun.guo at intel.com> | Sat Mar 13 13:52:21 2021 +0800| [bd3ca0859e993a41aae9105e32cd7f2a3c57d468] | committer: Guo, Yejun

lavfi/dnn_backend_openvino.c: fix mem leak for input_blob and output_blob upon error

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

 libavfilter/dnn/dnn_backend_openvino.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavfilter/dnn/dnn_backend_openvino.c b/libavfilter/dnn/dnn_backend_openvino.c
index d86fb124d5..df1631e86e 100644
--- a/libavfilter/dnn/dnn_backend_openvino.c
+++ b/libavfilter/dnn/dnn_backend_openvino.c
@@ -141,12 +141,14 @@ static DNNReturnType fill_model_input_ov(OVModel *ov_model, RequestItem *request
     status |= ie_blob_get_dims(input_blob, &dims);
     status |= ie_blob_get_precision(input_blob, &precision);
     if (status != OK) {
+        ie_blob_free(&input_blob);
         av_log(ctx, AV_LOG_ERROR, "Failed to get input blob dims/precision\n");
         return DNN_ERROR;
     }
 
     status = ie_blob_get_buffer(input_blob, &blob_buffer);
     if (status != OK) {
+        ie_blob_free(&input_blob);
         av_log(ctx, AV_LOG_ERROR, "Failed to get input blob buffer\n");
         return DNN_ERROR;
     }
@@ -211,6 +213,7 @@ static void infer_completion_callback(void *args)
 
     status = ie_blob_get_buffer(output_blob, &blob_buffer);
     if (status != OK) {
+        ie_blob_free(&output_blob);
         av_log(ctx, AV_LOG_ERROR, "Failed to access output memory\n");
         return;
     }
@@ -218,6 +221,7 @@ static void infer_completion_callback(void *args)
     status |= ie_blob_get_dims(output_blob, &dims);
     status |= ie_blob_get_precision(output_blob, &precision);
     if (status != OK) {
+        ie_blob_free(&output_blob);
         av_log(ctx, AV_LOG_ERROR, "Failed to get dims or precision of output\n");
         return;
     }



More information about the ffmpeg-cvslog mailing list