diff options
author | Zhao Zhili <zhilizhao@tencent.com> | 2023-09-02 16:23:57 +0800 |
---|---|---|
committer | Guo Yejun <yejun.guo@intel.com> | 2023-09-15 13:02:15 +0800 |
commit | 37123100d29ee934188b4007d75751e3c0fa2eba (patch) | |
tree | 808edb4a679c7539109b8caf98f8f5964fd4e53a /libavfilter/dnn | |
parent | d2c5c3b7ef7d202fd428c66ceab89e9e9f474f02 (diff) | |
download | ffmpeg-37123100d29ee934188b4007d75751e3c0fa2eba.tar.gz |
avfilter/dnn_backend_openvino: fix leak of ov_shape_t
Diffstat (limited to 'libavfilter/dnn')
-rw-r--r-- | libavfilter/dnn/dnn_backend_openvino.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libavfilter/dnn/dnn_backend_openvino.c b/libavfilter/dnn/dnn_backend_openvino.c index b3910adfc3..f9944211da 100644 --- a/libavfilter/dnn/dnn_backend_openvino.c +++ b/libavfilter/dnn/dnn_backend_openvino.c @@ -225,6 +225,7 @@ static int fill_model_input_ov(OVModel *ov_model, OVRequestItem *request) status = ov_port_get_element_type(ov_model->input_port, &precision); if (status != OK) { av_log(ctx, AV_LOG_ERROR, "Failed to get input port data type.\n"); + ov_shape_free(&input_shape); return ov2_map_error(status, NULL); } } else { @@ -236,8 +237,10 @@ static int fill_model_input_ov(OVModel *ov_model, OVRequestItem *request) input.channels = dims[1]; input.dt = precision_to_datatype(precision); input.data = av_malloc(input.height * input.width * input.channels * get_datatype_size(input.dt)); - if (!input.data) + if (!input.data) { + ov_shape_free(&input_shape); return AVERROR(ENOMEM); + } input_data_ptr = input.data; #else status = ie_infer_request_get_blob(request->infer_request, task->input_name, &input_blob); @@ -300,6 +303,7 @@ static int fill_model_input_ov(OVModel *ov_model, OVRequestItem *request) } #if HAVE_OPENVINO2 status = ov_tensor_create_from_host_ptr(precision, input_shape, input.data, &tensor); + ov_shape_free(&input_shape); if (status != OK) { av_log(ctx, AV_LOG_ERROR, "Failed to create tensor from host prt.\n"); return ov2_map_error(status, NULL); @@ -362,12 +366,14 @@ static void infer_completion_callback(void *args) status = ov_port_get_element_type(ov_model->output_port, &precision); if (status != OK) { av_log(ctx, AV_LOG_ERROR, "Failed to get output port data type.\n"); + ov_shape_free(&output_shape); return; } output.channels = dims[1]; output.height = dims[2]; output.width = dims[3]; av_assert0(request->lltask_count <= dims[0]); + ov_shape_free(&output_shape); #else IEStatusCode status; dimensions_t dims; |