提交 5cf0c67b 编写于 作者: C cjh9368

fix bug

上级 4d963d96
......@@ -52,7 +52,7 @@ std::vector<Tensor *> GetCNodeInputTensors(const CNodePtr &CNode) {
delete lite_tensor;
return input_tensors;
}
auto tensor_data = reinterpret_cast<uint8_t *>(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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册