History

dnn_backend_openvino.c: refine code for error handle

Guo, Yejun committed 5 years ago

Commit 38089921 parent 2b177031 file · +6 −16Browse files

Unified · Split

libavfilter/dnn/dnn_backend_openvino.c+6−16
@@ -336,8 +336,11 @@ DNNModel *ff_dnn_load_model_ov(const char *model_filename, const char *options, · 335 unmodified lines
336 }336 }
337 337
338 ov_model = av_mallocz(sizeof(OVModel));338 ov_model = av_mallocz(sizeof(OVModel));
339 if (!ov_model)339 if (!ov_model) {
340 goto err;340 av_freep(&model);
341 return NULL;
342 }
343 model->model = (void *)ov_model;
341 ov_model->model = model;344 ov_model->model = model;
342 ov_model->ctx.class = &dnn_openvino_class;345 ov_model->ctx.class = &dnn_openvino_class;
343 ctx = &ov_model->ctx;346 ctx = &ov_model->ctx;
@@ -377,7 +380,6 @@ DNNModel *ff_dnn_load_model_ov(const char *model_filename, const char *options, · 33 unmodified lines
377 if (status != OK)380 if (status != OK)
378 goto err;381 goto err;
379 382
380 model->model = (void *)ov_model;
381 model->get_input = &get_input_ov;383 model->get_input = &get_input_ov;
382 model->get_output = &get_output_ov;384 model->get_output = &get_output_ov;
383 model->options = options;385 model->options = options;
@@ -386,19 +388,7 @@ DNNModel *ff_dnn_load_model_ov(const char *model_filename, const char *options, · 2 unmodified lines
386 return model;388 return model;
387 389
388err:390err:
389 if (model)391 ff_dnn_free_model_ov(&model);
390 av_freep(&model);
391 if (ov_model) {
392 if (ov_model->infer_request)
393 ie_infer_request_free(&ov_model->infer_request);
394 if (ov_model->exe_network)
395 ie_exec_network_free(&ov_model->exe_network);
396 if (ov_model->network)
397 ie_network_free(&ov_model->network);
398 if (ov_model->core)
399 ie_core_free(&ov_model->core);
400 av_freep(&ov_model);
401 }
402 return NULL;392 return NULL;
403}393}
404 394

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