!14031 fix model buf may double free

From: @xutianchun
Reviewed-by: @HilbertDavid,@zhanghaibo5
Signed-off-by: @HilbertDavid
pull/14031/MERGE
mindspore-ci-bot 4 years ago committed by Gitee
commit ecb27493b3

@ -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