1
0
mirror of https://git.ffmpeg.org/ffmpeg.git synced 2026-10-24 02:09:03 +03:00

avfilter/dnn_backend_openvino: free the frames when execution fails before the task is queued

This is not a security issue.

Fixes: 6HSeekmc6mV7
Fixes: 8YwigyLd85Gn
Fixes: swarm-Memory-leak-of-input-output-frames-on-ff_dnn_execute_model-failure-3a5cbe
Fixes: memleak
Memory leak Replicated through UnModified FFmpeg with LSan

Found-by: zhang xingxing <2388969553@qq.com>
This commit is contained in:
Michael Niedermayer
2026-10-13 06:10:51 +02:00
committed by michaelni
parent 91be1619e2
commit 25e4cde609

View File

@@ -1502,26 +1502,28 @@ static int dnn_execute_model_ov(const DNNModel *model, DNNExecBaseParams *exec_p
exec_params->output_names, exec_params->nb_output);
if (ret != 0) {
av_log(ctx, AV_LOG_ERROR, "Failed init OpenVINO executable network or inference request\n");
return ret;
goto fail;
}
}
task = av_malloc(sizeof(*task));
if (!task) {
av_log(ctx, AV_LOG_ERROR, "unable to alloc memory for task item.\n");
return AVERROR(ENOMEM);
ret = AVERROR(ENOMEM);
goto fail;
}
ret = ff_dnn_fill_task(task, exec_params, ov_model, ctx->async, 1);
if (ret != 0) {
av_freep(&task);
return ret;
goto fail;
}
if (ff_queue_push_back(ov_model->task_queue, task) < 0) {
av_freep(&task);
av_log(ctx, AV_LOG_ERROR, "unable to push back task_queue.\n");
return AVERROR(ENOMEM);
ret = AVERROR(ENOMEM);
goto fail;
}
ret = extract_lltask_from_task(model->func_type, task, ov_model->lltask_queue, exec_params);
@@ -1566,6 +1568,10 @@ static int dnn_execute_model_ov(const DNNModel *model, DNNExecBaseParams *exec_p
}
return execute_model_ov(request, ov_model->lltask_queue);
}
fail:
av_frame_free(&exec_params->in_frame);
av_frame_free(&exec_params->out_frame);
return ret;
}
static DNNAsyncStatusType dnn_get_result_ov(const DNNModel *model, AVFrame **in, AVFrame **out)