diff --git a/mindspore/lite/src/lite_session.cc b/mindspore/lite/src/lite_session.cc index 299d5abb95e..b87d367ae60 100644 --- a/mindspore/lite/src/lite_session.cc +++ b/mindspore/lite/src/lite_session.cc @@ -284,7 +284,6 @@ int LiteSession::CompileGraph(Model *model) { is_running_.store(false); return ret; } - model->Free(); is_running_.store(false); return RET_OK; } diff --git a/mindspore/lite/src/model.cc b/mindspore/lite/src/model.cc index b3e545d6e1b..2393312cbd9 100644 --- a/mindspore/lite/src/model.cc +++ b/mindspore/lite/src/model.cc @@ -85,12 +85,15 @@ Model *Model::Import(const char *model_buf, size_t size) { model->buf = reinterpret_cast(malloc(size)); if (model->buf == nullptr) { MS_LOG(ERROR) << "new inner model buf fail!"; + delete(model); return nullptr; } memcpy(model->buf, model_buf, size); auto meta_graph = schema::GetMetaGraph(model->buf); if (meta_graph == nullptr) { MS_LOG(ERROR) << "meta_graph is nullptr!"; + delete(model); + free(model->buf); return nullptr; } diff --git a/mindspore/lite/tools/benchmark/benchmark.cc b/mindspore/lite/tools/benchmark/benchmark.cc index 2ae68aa0cc2..b5cf34da5ba 100644 --- a/mindspore/lite/tools/benchmark/benchmark.cc +++ b/mindspore/lite/tools/benchmark/benchmark.cc @@ -355,10 +355,6 @@ int Benchmark::RunBenchmark(const std::string &deviceType) { return RET_ERROR; } auto model = lite::Model::Import(graphBuf, size); - auto model_version = model->version_; - if (model_version != Version()) { - MS_LOG(WARNING) << "model version is " << model_version << ", inference version is " << Version() << " not equal"; - } if (model == nullptr) { MS_LOG(ERROR) << "Import model file failed while running " << modelName.c_str(); std::cerr << "Import model file failed while running " << modelName.c_str() << std::endl; @@ -404,6 +400,7 @@ int Benchmark::RunBenchmark(const std::string &deviceType) { delete (model); return ret; } + model->Free(); msInputs = session->GetInputs(); auto endPrepareTime = GetTimeUs(); #if defined(__arm__) diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_pad_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_pad_parser.cc index 92b56a3fc5b..e131cb27c56 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_pad_parser.cc +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_pad_parser.cc @@ -17,8 +17,8 @@ #include "tools/converter/parser/tflite/tflite_pad_parser.h" #include #include -#include #include +#include namespace mindspore { namespace lite {