Browse Source

!14031 fix model buf may double free

From: @xutianchun
Reviewed-by: @HilbertDavid,@zhanghaibo5
Signed-off-by: @HilbertDavid
pull/14031/MERGE
mindspore-ci-bot Gitee 4 years ago
parent
commit
ecb27493b3
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