mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2026-10-28 10:04:37 +08:00
avfilter/dnn_backend_openvino: fix partial shape leak in get_output_ov()
With input_resizable enabled, get_output_ov() created partial_shape with
ov_partial_shape_create() and then passed the same variable to
ov_shape_to_partial_shape(), which allocates a new dims array and
overwrites the struct. The first allocation was never freed, so every
call leaked it, on the success path and on the two error returns in
between. The dims it was built from were never used.
Drop the ov_partial_shape_create() call and the dims array; the partial
shape is built from the model's input shape by ov_shape_to_partial_shape()
and freed after ov_model_reshape_single_input() as before.
The leak was introduced with the OpenVINO API 2.0 support in e79bd1f1b1.
Signed-off-by: Jake Fineman <jake@wave.online>
This commit is contained in:
1 parent
c220739be5
commit
15423fa745
1 file changed
-6
@@ -1272,7 +1272,6 @@ static int get_output_ov(DNNModel *model, const char *input_name, int input_widt
|
||||
const char *output_name, int *output_width, int *output_height)
|
||||
{
|
||||
#if HAVE_OPENVINO2
|
||||
ov_dimension_t dims[4] = {{1, 1}, {1, 1}, {input_height, input_height}, {input_width, input_width}};
|
||||
ov_status_e status;
|
||||
ov_shape_t input_shape = {0};
|
||||
ov_partial_shape_t partial_shape;
|
||||
@@ -1300,11 +1299,6 @@ static int get_output_ov(DNNModel *model, const char *input_name, int input_widt
|
||||
|
||||
#if HAVE_OPENVINO2
|
||||
if (ctx->ov_option.input_resizable) {
|
||||
status = ov_partial_shape_create(4, dims, &partial_shape);
|
||||
if (status != OK) {
|
||||
av_log(ctx, AV_LOG_ERROR, "Failed to create partial shape.\n");
|
||||
return ov2_map_error(status, NULL);
|
||||
}
|
||||
status = ov_const_port_get_shape(ov_model->input_port, &input_shape);
|
||||
if (status != OK) {
|
||||
av_log(ctx, AV_LOG_ERROR, "Failed to create shape for model input resize.\n");
|
||||
|
||||
Reference in new issue
Block a user