From: Ting Fu <ting.fu-at-intel.com@ffmpeg.org> To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH V2 1/3] lavfi/dnn: fix corruption when TF backend infer failed Date: Fri, 24 Mar 2023 15:30:38 +0800 Message-ID: <20230324073040.16310-1-ting.fu@intel.com> (raw) Signed-off-by: Ting Fu <ting.fu@intel.com> --- libavfilter/dnn/dnn_backend_tf.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/libavfilter/dnn/dnn_backend_tf.c b/libavfilter/dnn/dnn_backend_tf.c index 3b5084b67b..9570f188d2 100644 --- a/libavfilter/dnn/dnn_backend_tf.c +++ b/libavfilter/dnn/dnn_backend_tf.c @@ -175,10 +175,6 @@ static int tf_start_inference(void *args) request->status); if (TF_GetCode(request->status) != TF_OK) { av_log(&tf_model->ctx, AV_LOG_ERROR, "%s", TF_Message(request->status)); - tf_free_request(infer_request); - if (ff_safe_queue_push_back(tf_model->request_queue, request) < 0) { - destroy_request_item(&request); - } return DNN_GENERIC_ERROR; } return 0; @@ -438,8 +434,6 @@ static int load_tf_model(TFModel *tf_model, const char *model_filename) TF_DeleteImportGraphDefOptions(graph_opts); TF_DeleteBuffer(graph_def); if (TF_GetCode(tf_model->status) != TF_OK){ - TF_DeleteGraph(tf_model->graph); - TF_DeleteStatus(tf_model->status); av_log(ctx, AV_LOG_ERROR, "Failed to import serialized graph to model graph\n"); av_freep(&sess_config); return DNN_GENERIC_ERROR; @@ -452,8 +446,6 @@ static int load_tf_model(TFModel *tf_model, const char *model_filename) TF_SetConfig(sess_opts, sess_config, sess_config_length,tf_model->status); av_freep(&sess_config); if (TF_GetCode(tf_model->status) != TF_OK) { - TF_DeleteGraph(tf_model->graph); - TF_DeleteStatus(tf_model->status); TF_DeleteSessionOptions(sess_opts); av_log(ctx, AV_LOG_ERROR, "Failed to set config for sess options with %s\n", tf_model->ctx.options.sess_config); @@ -465,8 +457,6 @@ static int load_tf_model(TFModel *tf_model, const char *model_filename) TF_DeleteSessionOptions(sess_opts); if (TF_GetCode(tf_model->status) != TF_OK) { - TF_DeleteGraph(tf_model->graph); - TF_DeleteStatus(tf_model->status); av_log(ctx, AV_LOG_ERROR, "Failed to create new session with model graph\n"); return DNN_GENERIC_ERROR; } @@ -479,9 +469,6 @@ static int load_tf_model(TFModel *tf_model, const char *model_filename) &init_op, 1, NULL, tf_model->status); if (TF_GetCode(tf_model->status) != TF_OK) { - TF_DeleteSession(tf_model->session, tf_model->status); - TF_DeleteGraph(tf_model->graph); - TF_DeleteStatus(tf_model->status); av_log(ctx, AV_LOG_ERROR, "Failed to run session when initializing\n"); return DNN_GENERIC_ERROR; } @@ -865,6 +852,7 @@ DNNModel *ff_dnn_load_model_tf(const char *model_filename, DNNFunctionType func_ av_freep(&model); return NULL; } + model->model = tf_model; tf_model->model = model; ctx = &tf_model->ctx; ctx->class = &dnn_tensorflow_class; @@ -931,7 +919,6 @@ DNNModel *ff_dnn_load_model_tf(const char *model_filename, DNNFunctionType func_ goto err; } - model->model = tf_model; model->get_input = &get_input_tf; model->get_output = &get_output_tf; model->options = options; -- 2.17.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".
next reply other threads:[~2023-03-24 7:47 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-03-24 7:30 Ting Fu [this message] 2023-03-24 7:30 ` [FFmpeg-devel] [PATCH V2 2/3] lavfi/dnn: fix mem leak in TF backend error handle Ting Fu 2023-03-24 7:30 ` [FFmpeg-devel] [PATCH V2 3/3] lavfi/dnn: add error info for TF backend filling task failure Ting Fu 2023-03-25 10:54 ` Guo, Yejun
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230324073040.16310-1-ting.fu@intel.com \ --to=ting.fu-at-intel.com@ffmpeg.org \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
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