Browse Source

fix model buf may double free

pull/14031/head
xutianchun 5 years ago
parent
commit
ca38cff71d
1 changed files with 3 additions and 0 deletions
  1. +3
    -0
      mindspore/lite/src/lite_model.cc

+ 3
- 0
mindspore/lite/src/lite_model.cc View File

@@ -333,6 +333,9 @@ Model *ImportFromBuffer(const char *model_buf, size_t size, bool take_buf) {
model->buf_size_ = size;
auto status = model->ConstructModel();
if (status != RET_OK) {
if (take_buf) {
model->buf = nullptr;
}
MS_LOG(ERROR) << "construct model failed.";
delete model;
return nullptr;


Loading…
Cancel
Save