History

lavfi/dnn_backend_tensorflow.c: fix mem leak in load_tf_model

Ting Fu committed 5 years ago

Commit 3499ec81 parent a4e518c1 file · +8 −0Browse files

Showing the changes to libavfilter (1 of 1 file). Show all

Unified · Split

libavfilter/dnn/dnn_backend_tf.c+8−0
@@ -282,6 +282,9 @@ static DNNReturnType load_tf_model(TFModel *tf_model, const char *model_filename · 281 unmodified lines
282 TF_SetConfig(sess_opts, sess_config, sess_config_length,tf_model->status);282 TF_SetConfig(sess_opts, sess_config, sess_config_length,tf_model->status);
283 av_freep(&sess_config);283 av_freep(&sess_config);
284 if (TF_GetCode(tf_model->status) != TF_OK) {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 av_log(ctx, AV_LOG_ERROR, "Failed to set config for sess options with %s\n",288 av_log(ctx, AV_LOG_ERROR, "Failed to set config for sess options with %s\n",
286 tf_model->ctx.options.sess_config);289 tf_model->ctx.options.sess_config);
287 return DNN_ERROR;290 return DNN_ERROR;
@@ -292,6 +295,8 @@ static DNNReturnType load_tf_model(TFModel *tf_model, const char *model_filename · 4 unmodified lines
292 TF_DeleteSessionOptions(sess_opts);295 TF_DeleteSessionOptions(sess_opts);
293 if (TF_GetCode(tf_model->status) != TF_OK)296 if (TF_GetCode(tf_model->status) != TF_OK)
294 {297 {
298 TF_DeleteGraph(tf_model->graph);
299 TF_DeleteStatus(tf_model->status);
295 av_log(ctx, AV_LOG_ERROR, "Failed to create new session with model graph\n");300 av_log(ctx, AV_LOG_ERROR, "Failed to create new session with model graph\n");
296 return DNN_ERROR;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 &init_op, 1, NULL, tf_model->status);309 &init_op, 1, NULL, tf_model->status);
305 if (TF_GetCode(tf_model->status) != TF_OK)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 av_log(ctx, AV_LOG_ERROR, "Failed to run session when initializing\n");315 av_log(ctx, AV_LOG_ERROR, "Failed to run session when initializing\n");
308 return DNN_ERROR;316 return DNN_ERROR;
309 }317 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t