Commit 15423fa745 for ffmpeg
commit 15423fa74561fce4d75dba40cbb400869b41f564
Author: Jake Fineman <jake@wave.online>
Date: Thu Oct 1 09:18:35 2026 -0400
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>
diff --git a/libavfilter/dnn/dnn_backend_openvino.c b/libavfilter/dnn/dnn_backend_openvino.c
index 7ec3bb1632..82fd145a86 100644
--- a/libavfilter/dnn/dnn_backend_openvino.c
+++ b/libavfilter/dnn/dnn_backend_openvino.c
@@ -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");