diff options
author | Zhao Zhili <zhilizhao@tencent.com> | 2023-09-02 16:23:59 +0800 |
---|---|---|
committer | Guo Yejun <yejun.guo@intel.com> | 2023-09-15 13:02:15 +0800 |
commit | 4f4dc0a1a29d3689ba8e73a08c13d4f2e152aad1 (patch) | |
tree | f0def115d6d1cd14ff0283bb628c660186c399ee | |
parent | 791b88fcb49805df593d6d08803568ace3d2a017 (diff) | |
download | ffmpeg-4f4dc0a1a29d3689ba8e73a08c13d4f2e152aad1.tar.gz |
avfilter/dnn_backend_openvino: fix wild pointer on error path
When ov_model_const_input_by_name/ov_model_const_output_by_name
failed, input_port/output_port can be wild pointer.
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
-rw-r--r-- | libavfilter/dnn/dnn_backend_openvino.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/libavfilter/dnn/dnn_backend_openvino.c b/libavfilter/dnn/dnn_backend_openvino.c index 5de27719b2..ded156289b 100644 --- a/libavfilter/dnn/dnn_backend_openvino.c +++ b/libavfilter/dnn/dnn_backend_openvino.c @@ -210,7 +210,10 @@ static int fill_model_input_ov(OVModel *ov_model, OVRequestItem *request) #if HAVE_OPENVINO2 if (!ov_model_is_dynamic(ov_model->ov_model)) { - ov_output_const_port_free(ov_model->input_port); + if (ov_model->input_port) { + ov_output_const_port_free(ov_model->input_port); + ov_model->input_port = NULL; + } status = ov_model_const_input_by_name(ov_model->ov_model, task->input_name, &ov_model->input_port); if (status != OK) { av_log(ctx, AV_LOG_ERROR, "Failed to get input port shape.\n"); @@ -621,8 +624,10 @@ static int init_model_ov(OVModel *ov_model, const char *input_name, const char * ov_model_free(tmp_ov_model); //update output_port - if (ov_model->output_port) + if (ov_model->output_port) { ov_output_const_port_free(ov_model->output_port); + ov_model->output_port = NULL; + } status = ov_model_const_output_by_name(ov_model->ov_model, output_name, &ov_model->output_port); if (status != OK) { av_log(ctx, AV_LOG_ERROR, "Failed to get output port.\n"); |