From 5cf0c67b260f8926c27c834c3ae608659f1d699e Mon Sep 17 00:00:00 2001 From: cjh9368 Date: Mon, 31 Aug 2020 14:34:23 +0800 Subject: [PATCH] fix bug --- .../lite/tools/optimizer/fusion/constant_folding_fusion.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mindspore/lite/tools/optimizer/fusion/constant_folding_fusion.cc b/mindspore/lite/tools/optimizer/fusion/constant_folding_fusion.cc index 2ca1d8d4c..992e91dd1 100644 --- a/mindspore/lite/tools/optimizer/fusion/constant_folding_fusion.cc +++ b/mindspore/lite/tools/optimizer/fusion/constant_folding_fusion.cc @@ -52,7 +52,7 @@ std::vector GetCNodeInputTensors(const CNodePtr &CNode) { delete lite_tensor; return input_tensors; } - auto tensor_data = reinterpret_cast(malloc(lite_tensor_size / sizeof(char))); + auto tensor_data = new (std::nothrow) uint8_t[lite_tensor_size / sizeof(char)]; if (tensor_data == nullptr) { MS_LOG(ERROR) << "tensor_data is nullptr"; delete lite_tensor; @@ -92,7 +92,7 @@ ParameterPtr CreateNewParamter(const FuncGraphPtr &func_graph, Tensor *tensor) { } auto ret = memcpy_s(tensor_data, size * sizeof(float), tensor->Data(), size * sizeof(float)); if (ret != EOK) { - delete tensor_data; + delete[] tensor_data; MS_LOG(ERROR) << "memcpy error: " << ret; return nullptr; } -- GitLab