diff mbox series

[FFmpeg-devel,2/5] lavfi/dnn_backend_openvino.c: fix mem leak for input_blob and output_blob upon error

Message ID 20210313062855.27212-2-yejun.guo@intel.com
State Accepted
Commit bd3ca0859e993a41aae9105e32cd7f2a3c57d468
Headers show
Series [FFmpeg-devel,1/5] lavfi/dnn_backend_openvino.c: fix mem leak for AVFrame upon error | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Guo, Yejun March 13, 2021, 6:28 a.m. UTC
---
 libavfilter/dnn/dnn_backend_openvino.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

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;
     }