Unified · Split
| @@ -282,6 +282,9 @@ static DNNReturnType load_tf_model(TFModel *tf_model, const char *model_filename · 281 unmodified lines | ||
| 282 | 282 | TF_SetConfig(sess_opts, sess_config, sess_config_length,tf_model->status); |
| 283 | 283 | av_freep(&sess_config); |
| 284 | 284 | if (TF_GetCode(tf_model->status) != TF_OK) { |
| 285 | + TF_DeleteGraph(tf_model->graph); | |
| 286 | + TF_DeleteStatus(tf_model->status); | |
| 287 | + TF_DeleteSessionOptions(sess_opts); | |
| 285 | 288 | av_log(ctx, AV_LOG_ERROR, "Failed to set config for sess options with %s\n", |
| 286 | 289 | tf_model->ctx.options.sess_config); |
| 287 | 290 | return DNN_ERROR; |
| @@ -292,6 +295,8 @@ static DNNReturnType load_tf_model(TFModel *tf_model, const char *model_filename · 4 unmodified lines | ||
| 292 | 295 | TF_DeleteSessionOptions(sess_opts); |
| 293 | 296 | if (TF_GetCode(tf_model->status) != TF_OK) |
| 294 | 297 | { |
| 298 | + TF_DeleteGraph(tf_model->graph); | |
| 299 | + TF_DeleteStatus(tf_model->status); | |
| 295 | 300 | av_log(ctx, AV_LOG_ERROR, "Failed to create new session with model graph\n"); |
| 296 | 301 | return DNN_ERROR; |
| 297 | 302 | } |
| @@ -304,6 +309,9 @@ static DNNReturnType load_tf_model(TFModel *tf_model, const char *model_filename · 6 unmodified lines | ||
| 304 | 309 | &init_op, 1, NULL, tf_model->status); |
| 305 | 310 | if (TF_GetCode(tf_model->status) != TF_OK) |
| 306 | 311 | { |
| 312 | + TF_DeleteSession(tf_model->session, tf_model->status); | |
| 313 | + TF_DeleteGraph(tf_model->graph); | |
| 314 | + TF_DeleteStatus(tf_model->status); | |
| 307 | 315 | av_log(ctx, AV_LOG_ERROR, "Failed to run session when initializing\n"); |
| 308 | 316 | return DNN_ERROR; |
| 309 | 317 | } |