Message ID | 20210313062855.27212-5-yejun.guo@intel.com |
---|---|
State | Accepted |
Commit | da12d600ea6d16ea1b61d0b9a2530dea0bbbb870 |
Headers | show |
Series | [FFmpeg-devel,1/5] lavfi/dnn_backend_openvino.c: fix mem leak for AVFrame upon error | expand |
Context | Check | Description |
---|---|---|
andriy/x86_make | success | Make finished |
andriy/x86_make_fate | success | Make fate finished |
andriy/PPC64_make | success | Make finished |
andriy/PPC64_make_fate | success | Make fate finished |
> -----Original Message----- > From: Guo, Yejun <yejun.guo@intel.com> > Sent: 2021年3月13日 14:29 > To: ffmpeg-devel@ffmpeg.org > Cc: Guo, Yejun <yejun.guo@intel.com> > Subject: [PATCH 5/5] lavfi/dnn_backend_openvino.c: fix mem leak for TaskItem > upon error > > --- > 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 55cb0c757e..9a47d74c15 100644 > --- a/libavfilter/dnn/dnn_backend_openvino.c > +++ b/libavfilter/dnn/dnn_backend_openvino.c > @@ -678,12 +678,6 @@ DNNReturnType > ff_dnn_execute_model_async_ov(const DNNModel *model, const char *i > return DNN_ERROR; > } > > - task = av_malloc(sizeof(*task)); > - if (!task) { > - av_log(ctx, AV_LOG_ERROR, "unable to alloc memory for task > item.\n"); > - return DNN_ERROR; > - } > - > if (!ov_model->exe_network) { > if (init_model_ov(ov_model, input_name, output_names[0]) != > DNN_SUCCESS) { > av_log(ctx, AV_LOG_ERROR, "Failed init OpenVINO exectuable > network or inference request\n"); @@ -691,6 +685,12 @@ DNNReturnType > ff_dnn_execute_model_async_ov(const DNNModel *model, const char *i > } > } > > + task = av_malloc(sizeof(*task)); > + if (!task) { > + av_log(ctx, AV_LOG_ERROR, "unable to alloc memory for task > item.\n"); > + return DNN_ERROR; > + } > + > task->done = 0; > task->do_ioproc = 1; > task->async = 1; > -- > 2.17.1 will push tomorrow if there's no objection, thanks.
diff --git a/libavfilter/dnn/dnn_backend_openvino.c b/libavfilter/dnn/dnn_backend_openvino.c index 55cb0c757e..9a47d74c15 100644 --- a/libavfilter/dnn/dnn_backend_openvino.c +++ b/libavfilter/dnn/dnn_backend_openvino.c @@ -678,12 +678,6 @@ DNNReturnType ff_dnn_execute_model_async_ov(const DNNModel *model, const char *i return DNN_ERROR; } - task = av_malloc(sizeof(*task)); - if (!task) { - av_log(ctx, AV_LOG_ERROR, "unable to alloc memory for task item.\n"); - return DNN_ERROR; - } - if (!ov_model->exe_network) { if (init_model_ov(ov_model, input_name, output_names[0]) != DNN_SUCCESS) { av_log(ctx, AV_LOG_ERROR, "Failed init OpenVINO exectuable network or inference request\n"); @@ -691,6 +685,12 @@ DNNReturnType ff_dnn_execute_model_async_ov(const DNNModel *model, const char *i } } + task = av_malloc(sizeof(*task)); + if (!task) { + av_log(ctx, AV_LOG_ERROR, "unable to alloc memory for task item.\n"); + return DNN_ERROR; + } + task->done = 0; task->do_ioproc = 1; task->async = 1;