* [FFmpeg-devel] [PATCH v2 1/8] avfilter/dnn_filter_common: fix memleak
[not found] <20230902082359.260925-1-quinkblack@foxmail.com>
@ 2023-09-02 8:23 ` Zhao Zhili
2023-09-02 8:23 ` [FFmpeg-devel] [PATCH v2 2/8] avfilter/dnn_backend_openvino: fix multiple memleaks Zhao Zhili
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Zhao Zhili @ 2023-09-02 8:23 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Zhao Zhili
From: Zhao Zhili <zhilizhao@tencent.com>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
---
libavfilter/dnn_filter_common.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/libavfilter/dnn_filter_common.c b/libavfilter/dnn_filter_common.c
index d175c91914..3b9182c1d1 100644
--- a/libavfilter/dnn_filter_common.c
+++ b/libavfilter/dnn_filter_common.c
@@ -159,4 +159,10 @@ void ff_dnn_uninit(DnnContext *ctx)
if (ctx->dnn_module) {
(ctx->dnn_module->free_model)(&ctx->model);
}
+ if (ctx->model_outputnames) {
+ for (int i = 0; i < ctx->nb_outputs; i++)
+ av_free(ctx->model_outputnames[i]);
+
+ av_freep(&ctx->model_outputnames);
+ }
}
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 9+ messages in thread
* [FFmpeg-devel] [PATCH v2 2/8] avfilter/dnn_backend_openvino: fix multiple memleaks
[not found] <20230902082359.260925-1-quinkblack@foxmail.com>
2023-09-02 8:23 ` [FFmpeg-devel] [PATCH v2 1/8] avfilter/dnn_filter_common: fix memleak Zhao Zhili
@ 2023-09-02 8:23 ` Zhao Zhili
2023-09-02 8:23 ` [FFmpeg-devel] [PATCH v2 3/8] avfilter/dnn_backend_openvino: reduce indentation in free_model_ov Zhao Zhili
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Zhao Zhili @ 2023-09-02 8:23 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Zhao Zhili
From: Zhao Zhili <zhilizhao@tencent.com>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
---
libavfilter/dnn/dnn_backend_openvino.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/libavfilter/dnn/dnn_backend_openvino.c b/libavfilter/dnn/dnn_backend_openvino.c
index 4922833b07..951f179b7c 100644
--- a/libavfilter/dnn/dnn_backend_openvino.c
+++ b/libavfilter/dnn/dnn_backend_openvino.c
@@ -68,12 +68,12 @@ typedef struct OVModel{
ie_core_t *core;
ie_network_t *network;
ie_executable_network_t *exe_network;
+ const char *all_input_names;
+ const char *all_output_names;
#endif
SafeQueue *request_queue; // holds OVRequestItem
Queue *task_queue; // holds TaskItem
Queue *lltask_queue; // holds LastLevelTaskItem
- const char *all_input_names;
- const char *all_output_names;
} OVModel;
// one request for one call to openvino
@@ -508,7 +508,10 @@ static void dnn_free_model_ov(DNNModel **model)
ie_network_free(&ov_model->network);
if (ov_model->core)
ie_core_free(&ov_model->core);
+ av_free(ov_model->all_output_names);
+ av_free(ov_model->all_input_names);
#endif
+ av_opt_free(&ov_model->ctx);
av_freep(&ov_model);
av_freep(model);
}
@@ -1255,6 +1258,7 @@ static DNNModel *dnn_load_model_ov(const char *model_filename, DNNFunctionType f
goto err;
}
APPEND_STRING(ov_model->all_input_names, node_name)
+ ie_network_name_free(&node_name);
}
status = ie_network_get_outputs_number(ov_model->network, &node_count);
if (status != OK) {
@@ -1268,6 +1272,7 @@ static DNNModel *dnn_load_model_ov(const char *model_filename, DNNFunctionType f
goto err;
}
APPEND_STRING(ov_model->all_output_names, node_name)
+ ie_network_name_free(&node_name);
}
#endif
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 9+ messages in thread
* [FFmpeg-devel] [PATCH v2 3/8] avfilter/dnn_backend_openvino: reduce indentation in free_model_ov
[not found] <20230902082359.260925-1-quinkblack@foxmail.com>
2023-09-02 8:23 ` [FFmpeg-devel] [PATCH v2 1/8] avfilter/dnn_filter_common: fix memleak Zhao Zhili
2023-09-02 8:23 ` [FFmpeg-devel] [PATCH v2 2/8] avfilter/dnn_backend_openvino: fix multiple memleaks Zhao Zhili
@ 2023-09-02 8:23 ` Zhao Zhili
2023-09-02 8:23 ` [FFmpeg-devel] [PATCH v2 4/8] avfilter/dnn_backend_openvino: fix use uninitialized values Zhao Zhili
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Zhao Zhili @ 2023-09-02 8:23 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Zhao Zhili
From: Zhao Zhili <zhilizhao@tencent.com>
No functional changes except ensures model isn't null.
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
---
libavfilter/dnn/dnn_backend_openvino.c | 89 +++++++++++++-------------
1 file changed, 46 insertions(+), 43 deletions(-)
diff --git a/libavfilter/dnn/dnn_backend_openvino.c b/libavfilter/dnn/dnn_backend_openvino.c
index 951f179b7c..85db4ecd35 100644
--- a/libavfilter/dnn/dnn_backend_openvino.c
+++ b/libavfilter/dnn/dnn_backend_openvino.c
@@ -463,58 +463,61 @@ static void infer_completion_callback(void *args)
static void dnn_free_model_ov(DNNModel **model)
{
- if (*model){
- OVModel *ov_model = (*model)->model;
- while (ff_safe_queue_size(ov_model->request_queue) != 0) {
- OVRequestItem *item = ff_safe_queue_pop_front(ov_model->request_queue);
- if (item && item->infer_request) {
+ OVModel *ov_model;
+
+ if (!model || !*model)
+ return;
+
+ ov_model = (*model)->model;
+ while (ff_safe_queue_size(ov_model->request_queue) != 0) {
+ OVRequestItem *item = ff_safe_queue_pop_front(ov_model->request_queue);
+ if (item && item->infer_request) {
#if HAVE_OPENVINO2
- ov_infer_request_free(item->infer_request);
+ ov_infer_request_free(item->infer_request);
#else
- ie_infer_request_free(&item->infer_request);
+ ie_infer_request_free(&item->infer_request);
#endif
- }
- av_freep(&item->lltasks);
- av_freep(&item);
}
- ff_safe_queue_destroy(ov_model->request_queue);
+ av_freep(&item->lltasks);
+ av_freep(&item);
+ }
+ ff_safe_queue_destroy(ov_model->request_queue);
- while (ff_queue_size(ov_model->lltask_queue) != 0) {
- LastLevelTaskItem *item = ff_queue_pop_front(ov_model->lltask_queue);
- av_freep(&item);
- }
- ff_queue_destroy(ov_model->lltask_queue);
+ while (ff_queue_size(ov_model->lltask_queue) != 0) {
+ LastLevelTaskItem *item = ff_queue_pop_front(ov_model->lltask_queue);
+ av_freep(&item);
+ }
+ ff_queue_destroy(ov_model->lltask_queue);
- while (ff_queue_size(ov_model->task_queue) != 0) {
- TaskItem *item = ff_queue_pop_front(ov_model->task_queue);
- av_frame_free(&item->in_frame);
- av_frame_free(&item->out_frame);
- av_freep(&item);
- }
- ff_queue_destroy(ov_model->task_queue);
+ while (ff_queue_size(ov_model->task_queue) != 0) {
+ TaskItem *item = ff_queue_pop_front(ov_model->task_queue);
+ av_frame_free(&item->in_frame);
+ av_frame_free(&item->out_frame);
+ av_freep(&item);
+ }
+ ff_queue_destroy(ov_model->task_queue);
#if HAVE_OPENVINO2
- if (ov_model->preprocess)
- ov_preprocess_prepostprocessor_free(ov_model->preprocess);
- if (ov_model->compiled_model)
- ov_compiled_model_free(ov_model->compiled_model);
- if (ov_model->ov_model)
- ov_model_free(ov_model->ov_model);
- if (ov_model->core)
- ov_core_free(ov_model->core);
+ if (ov_model->preprocess)
+ ov_preprocess_prepostprocessor_free(ov_model->preprocess);
+ if (ov_model->compiled_model)
+ ov_compiled_model_free(ov_model->compiled_model);
+ if (ov_model->ov_model)
+ ov_model_free(ov_model->ov_model);
+ if (ov_model->core)
+ ov_core_free(ov_model->core);
#else
- if (ov_model->exe_network)
- ie_exec_network_free(&ov_model->exe_network);
- if (ov_model->network)
- ie_network_free(&ov_model->network);
- if (ov_model->core)
- ie_core_free(&ov_model->core);
- av_free(ov_model->all_output_names);
- av_free(ov_model->all_input_names);
+ if (ov_model->exe_network)
+ ie_exec_network_free(&ov_model->exe_network);
+ if (ov_model->network)
+ ie_network_free(&ov_model->network);
+ if (ov_model->core)
+ ie_core_free(&ov_model->core);
+ av_free(ov_model->all_output_names);
+ av_free(ov_model->all_input_names);
#endif
- av_opt_free(&ov_model->ctx);
- av_freep(&ov_model);
- av_freep(model);
- }
+ av_opt_free(&ov_model->ctx);
+ av_freep(&ov_model);
+ av_freep(model);
}
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 9+ messages in thread
* [FFmpeg-devel] [PATCH v2 4/8] avfilter/dnn_backend_openvino: fix use uninitialized values
[not found] <20230902082359.260925-1-quinkblack@foxmail.com>
` (2 preceding siblings ...)
2023-09-02 8:23 ` [FFmpeg-devel] [PATCH v2 3/8] avfilter/dnn_backend_openvino: reduce indentation in free_model_ov Zhao Zhili
@ 2023-09-02 8:23 ` Zhao Zhili
2023-09-02 8:23 ` [FFmpeg-devel] [PATCH v2 5/8] avfilter/dnn_backend_openvino: fix leak or ov_core_t on error path Zhao Zhili
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Zhao Zhili @ 2023-09-02 8:23 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Zhao Zhili
From: Zhao Zhili <zhilizhao@tencent.com>
Error handling was broken since neither `ret` nor `task` has being
initialized on error path.
---
libavfilter/dnn/dnn_backend_openvino.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/libavfilter/dnn/dnn_backend_openvino.c b/libavfilter/dnn/dnn_backend_openvino.c
index 85db4ecd35..7150bf0886 100644
--- a/libavfilter/dnn/dnn_backend_openvino.c
+++ b/libavfilter/dnn/dnn_backend_openvino.c
@@ -1090,37 +1090,37 @@ static int get_output_ov(void *model, const char *input_name, int input_width, i
status = ov_partial_shape_create(4, dims, &partial_shape);
if (status != OK) {
av_log(ctx, AV_LOG_ERROR, "Failed create partial shape.\n");
- goto err;
+ return ov2_map_error(status, NULL);
}
status = ov_const_port_get_shape(ov_model->input_port, &input_shape);
input_shape.dims[2] = input_height;
input_shape.dims[3] = input_width;
if (status != OK) {
av_log(ctx, AV_LOG_ERROR, "Failed create shape for model input resize.\n");
- goto err;
+ return ov2_map_error(status, NULL);
}
status = ov_shape_to_partial_shape(input_shape, &partial_shape);
if (status != OK) {
av_log(ctx, AV_LOG_ERROR, "Failed create partial shape for model input resize.\n");
- goto err;
+ return ov2_map_error(status, NULL);
}
status = ov_model_reshape_single_input(ov_model->ov_model, partial_shape);
if (status != OK) {
av_log(ctx, AV_LOG_ERROR, "Failed to reszie model input.\n");
- goto err;
+ return ov2_map_error(status, NULL);
}
} else {
avpriv_report_missing_feature(ctx, "Do not support dynamic model.");
- goto err;
+ return AVERROR(ENOTSUP);
}
}
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");
- goto err;
+ return ov2_map_error(status, NULL);
}
if (!ov_model->compiled_model) {
#else
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 9+ messages in thread
* [FFmpeg-devel] [PATCH v2 5/8] avfilter/dnn_backend_openvino: fix leak or ov_core_t on error path
[not found] <20230902082359.260925-1-quinkblack@foxmail.com>
` (3 preceding siblings ...)
2023-09-02 8:23 ` [FFmpeg-devel] [PATCH v2 4/8] avfilter/dnn_backend_openvino: fix use uninitialized values Zhao Zhili
@ 2023-09-02 8:23 ` Zhao Zhili
2023-09-02 8:23 ` [FFmpeg-devel] [PATCH v2 6/8] avfilter/dnn_backend_openvino: fix leak of ov_shape_t Zhao Zhili
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Zhao Zhili @ 2023-09-02 8:23 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Zhao Zhili
From: Zhao Zhili <zhilizhao@tencent.com>
---
libavfilter/dnn/dnn_backend_openvino.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavfilter/dnn/dnn_backend_openvino.c b/libavfilter/dnn/dnn_backend_openvino.c
index 7150bf0886..b3910adfc3 100644
--- a/libavfilter/dnn/dnn_backend_openvino.c
+++ b/libavfilter/dnn/dnn_backend_openvino.c
@@ -1213,6 +1213,7 @@ static DNNModel *dnn_load_model_ov(const char *model_filename, DNNFunctionType f
if (status != OK) {
goto err;
}
+ ov_model->core = core;
status = ov_core_read_model(core, model_filename, NULL, &ovmodel);
if (status != OK) {
@@ -1228,7 +1229,6 @@ static DNNModel *dnn_load_model_ov(const char *model_filename, DNNFunctionType f
goto err;
}
ov_model->ov_model = ovmodel;
- ov_model->core = core;
#else
ov_model->all_input_names = NULL;
ov_model->all_output_names = NULL;
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 9+ messages in thread
* [FFmpeg-devel] [PATCH v2 6/8] avfilter/dnn_backend_openvino: fix leak of ov_shape_t
[not found] <20230902082359.260925-1-quinkblack@foxmail.com>
` (4 preceding siblings ...)
2023-09-02 8:23 ` [FFmpeg-devel] [PATCH v2 5/8] avfilter/dnn_backend_openvino: fix leak or ov_core_t on error path Zhao Zhili
@ 2023-09-02 8:23 ` Zhao Zhili
2023-09-02 8:23 ` [FFmpeg-devel] [PATCH v2 7/8] avfilter/dnn_backend_openvino: fix input_port/output_port leaks Zhao Zhili
2023-09-02 8:23 ` [FFmpeg-devel] [PATCH v2 8/8] avfilter/dnn_backend_openvino: fix wild pointer on error path Zhao Zhili
7 siblings, 0 replies; 9+ messages in thread
From: Zhao Zhili @ 2023-09-02 8:23 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Zhao Zhili
From: Zhao Zhili <zhilizhao@tencent.com>
---
libavfilter/dnn/dnn_backend_openvino.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/libavfilter/dnn/dnn_backend_openvino.c b/libavfilter/dnn/dnn_backend_openvino.c
index b3910adfc3..f9944211da 100644
--- a/libavfilter/dnn/dnn_backend_openvino.c
+++ b/libavfilter/dnn/dnn_backend_openvino.c
@@ -225,6 +225,7 @@ static int fill_model_input_ov(OVModel *ov_model, OVRequestItem *request)
status = ov_port_get_element_type(ov_model->input_port, &precision);
if (status != OK) {
av_log(ctx, AV_LOG_ERROR, "Failed to get input port data type.\n");
+ ov_shape_free(&input_shape);
return ov2_map_error(status, NULL);
}
} else {
@@ -236,8 +237,10 @@ static int fill_model_input_ov(OVModel *ov_model, OVRequestItem *request)
input.channels = dims[1];
input.dt = precision_to_datatype(precision);
input.data = av_malloc(input.height * input.width * input.channels * get_datatype_size(input.dt));
- if (!input.data)
+ if (!input.data) {
+ ov_shape_free(&input_shape);
return AVERROR(ENOMEM);
+ }
input_data_ptr = input.data;
#else
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)
}
#if HAVE_OPENVINO2
status = ov_tensor_create_from_host_ptr(precision, input_shape, input.data, &tensor);
+ ov_shape_free(&input_shape);
if (status != OK) {
av_log(ctx, AV_LOG_ERROR, "Failed to create tensor from host prt.\n");
return ov2_map_error(status, NULL);
@@ -362,12 +366,14 @@ static void infer_completion_callback(void *args)
status = ov_port_get_element_type(ov_model->output_port, &precision);
if (status != OK) {
av_log(ctx, AV_LOG_ERROR, "Failed to get output port data type.\n");
+ ov_shape_free(&output_shape);
return;
}
output.channels = dims[1];
output.height = dims[2];
output.width = dims[3];
av_assert0(request->lltask_count <= dims[0]);
+ ov_shape_free(&output_shape);
#else
IEStatusCode status;
dimensions_t dims;
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 9+ messages in thread
* [FFmpeg-devel] [PATCH v2 7/8] avfilter/dnn_backend_openvino: fix input_port/output_port leaks
[not found] <20230902082359.260925-1-quinkblack@foxmail.com>
` (5 preceding siblings ...)
2023-09-02 8:23 ` [FFmpeg-devel] [PATCH v2 6/8] avfilter/dnn_backend_openvino: fix leak of ov_shape_t Zhao Zhili
@ 2023-09-02 8:23 ` Zhao Zhili
2023-09-02 8:23 ` [FFmpeg-devel] [PATCH v2 8/8] avfilter/dnn_backend_openvino: fix wild pointer on error path Zhao Zhili
7 siblings, 0 replies; 9+ messages in thread
From: Zhao Zhili @ 2023-09-02 8:23 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Zhao Zhili
From: Zhao Zhili <zhilizhao@tencent.com>
---
libavfilter/dnn/dnn_backend_openvino.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/libavfilter/dnn/dnn_backend_openvino.c b/libavfilter/dnn/dnn_backend_openvino.c
index f9944211da..5de27719b2 100644
--- a/libavfilter/dnn/dnn_backend_openvino.c
+++ b/libavfilter/dnn/dnn_backend_openvino.c
@@ -503,6 +503,10 @@ static void dnn_free_model_ov(DNNModel **model)
}
ff_queue_destroy(ov_model->task_queue);
#if HAVE_OPENVINO2
+ if (ov_model->input_port)
+ ov_output_const_port_free(ov_model->input_port);
+ if (ov_model->output_port)
+ ov_output_const_port_free(ov_model->output_port);
if (ov_model->preprocess)
ov_preprocess_prepostprocessor_free(ov_model->preprocess);
if (ov_model->compiled_model)
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 9+ messages in thread
* [FFmpeg-devel] [PATCH v2 8/8] avfilter/dnn_backend_openvino: fix wild pointer on error path
[not found] <20230902082359.260925-1-quinkblack@foxmail.com>
` (6 preceding siblings ...)
2023-09-02 8:23 ` [FFmpeg-devel] [PATCH v2 7/8] avfilter/dnn_backend_openvino: fix input_port/output_port leaks Zhao Zhili
@ 2023-09-02 8:23 ` Zhao Zhili
2023-09-08 9:59 ` Guo, Yejun
7 siblings, 1 reply; 9+ messages in thread
From: Zhao Zhili @ 2023-09-02 8:23 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Zhao Zhili
From: Zhao Zhili <zhilizhao@tencent.com>
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>
---
libavfilter/dnn/dnn_backend_openvino.c | 9 +++++++--
1 file 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");
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2 8/8] avfilter/dnn_backend_openvino: fix wild pointer on error path
2023-09-02 8:23 ` [FFmpeg-devel] [PATCH v2 8/8] avfilter/dnn_backend_openvino: fix wild pointer on error path Zhao Zhili
@ 2023-09-08 9:59 ` Guo, Yejun
0 siblings, 0 replies; 9+ messages in thread
From: Guo, Yejun @ 2023-09-08 9:59 UTC (permalink / raw)
To: FFmpeg development discussions and patches; +Cc: Zhao Zhili
> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> Zhao Zhili
> Sent: Saturday, September 2, 2023 4:24 PM
> To: ffmpeg-devel@ffmpeg.org
> Cc: Zhao Zhili <zhilizhao@tencent.com>
> Subject: [FFmpeg-devel] [PATCH v2 8/8] avfilter/dnn_backend_openvino: fix
> wild pointer on error path
>
> From: Zhao Zhili <zhilizhao@tencent.com>
>
> 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>
> ---
> libavfilter/dnn/dnn_backend_openvino.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
The patch set looks good to me, thanks.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2023-09-08 9:59 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20230902082359.260925-1-quinkblack@foxmail.com>
2023-09-02 8:23 ` [FFmpeg-devel] [PATCH v2 1/8] avfilter/dnn_filter_common: fix memleak Zhao Zhili
2023-09-02 8:23 ` [FFmpeg-devel] [PATCH v2 2/8] avfilter/dnn_backend_openvino: fix multiple memleaks Zhao Zhili
2023-09-02 8:23 ` [FFmpeg-devel] [PATCH v2 3/8] avfilter/dnn_backend_openvino: reduce indentation in free_model_ov Zhao Zhili
2023-09-02 8:23 ` [FFmpeg-devel] [PATCH v2 4/8] avfilter/dnn_backend_openvino: fix use uninitialized values Zhao Zhili
2023-09-02 8:23 ` [FFmpeg-devel] [PATCH v2 5/8] avfilter/dnn_backend_openvino: fix leak or ov_core_t on error path Zhao Zhili
2023-09-02 8:23 ` [FFmpeg-devel] [PATCH v2 6/8] avfilter/dnn_backend_openvino: fix leak of ov_shape_t Zhao Zhili
2023-09-02 8:23 ` [FFmpeg-devel] [PATCH v2 7/8] avfilter/dnn_backend_openvino: fix input_port/output_port leaks Zhao Zhili
2023-09-02 8:23 ` [FFmpeg-devel] [PATCH v2 8/8] avfilter/dnn_backend_openvino: fix wild pointer on error path Zhao Zhili
2023-09-08 9:59 ` Guo, Yejun
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git