History

avfilter/dnn_backend_openvino: fix leak of ov_shape_t

Zhao Zhili committed 3 years ago

Commit 37123101 parent d2c5c3b1 file · +7 −1Browse files

Showing the changes to libavfilter (1 of 1 file). Show all

Unified · Split

libavfilter/dnn/dnn_backend_openvino.c+7−1
@@ -225,6 +225,7 @@ static int fill_model_input_ov(OVModel *ov_model, OVRequestItem *request) · 224 unmodified lines
225225 status = ov_port_get_element_type(ov_model->input_port, &precision);
226226 if (status != OK) {
227227 av_log(ctx, AV_LOG_ERROR, "Failed to get input port data type.\n");
228+ ov_shape_free(&input_shape);
228229 return ov2_map_error(status, NULL);
229230 }
230231 } else {
@@ -236,8 +237,10 @@ static int fill_model_input_ov(OVModel *ov_model, OVRequestItem *request) · 5 unmodified lines
236237 input.channels = dims[1];
237238 input.dt = precision_to_datatype(precision);
238239 input.data = av_malloc(input.height * input.width * input.channels * get_datatype_size(input.dt));
239− if (!input.data)
240+ if (!input.data) {
241+ ov_shape_free(&input_shape);
240242 return AVERROR(ENOMEM);
243+ }
241244 input_data_ptr = input.data;
242245 #else
243246 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) · 56 unmodified lines
300303 }
301304 #if HAVE_OPENVINO2
302305 status = ov_tensor_create_from_host_ptr(precision, input_shape, input.data, &tensor);
306+ ov_shape_free(&input_shape);
303307 if (status != OK) {
304308 av_log(ctx, AV_LOG_ERROR, "Failed to create tensor from host prt.\n");
305309 return ov2_map_error(status, NULL);
@@ -362,12 +366,14 @@ static void infer_completion_callback(void *args) · 56 unmodified lines
362366 status = ov_port_get_element_type(ov_model->output_port, &precision);
363367 if (status != OK) {
364368 av_log(ctx, AV_LOG_ERROR, "Failed to get output port data type.\n");
369+ ov_shape_free(&output_shape);
365370 return;
366371 }
367372 output.channels = dims[1];
368373 output.height = dims[2];
369374 output.width = dims[3];
370375 av_assert0(request->lltask_count <= dims[0]);
376+ ov_shape_free(&output_shape);
371377 #else
372378 IEStatusCode status;
373379 dimensions_t dims;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t