diff --git a/mindspore/lite/src/runtime/kernel/cpu/fp32/convolution_delegate_fp32.cc b/mindspore/lite/src/runtime/kernel/cpu/fp32/convolution_delegate_fp32.cc index e937bf894da..aa51b9e8266 100644 --- a/mindspore/lite/src/runtime/kernel/cpu/fp32/convolution_delegate_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/cpu/fp32/convolution_delegate_fp32.cc @@ -233,7 +233,7 @@ bool ConvolutionDelegateCPUKernel::CheckAvxUseSWConv(const ConvParameter *conv_p kernel::LiteKernel *ConvolutionDelegateCPUKernel::CreateConv1x1MatmulKernel() { auto conv_param = reinterpret_cast(op_parameter_); - matmul_param_ = new (std::nothrow) MatMulParameter; + matmul_param_ = reinterpret_cast(malloc(sizeof(MatMulParameter))); if (matmul_param_ == nullptr) { MS_LOG(WARNING) << "Memory allocation failed, Create Conv1x1 Matmul Kernel failed."; return nullptr; diff --git a/mindspore/lite/src/runtime/kernel/cpu/fp32/convolution_delegate_fp32.h b/mindspore/lite/src/runtime/kernel/cpu/fp32/convolution_delegate_fp32.h index 076755e8756..c31724c100f 100644 --- a/mindspore/lite/src/runtime/kernel/cpu/fp32/convolution_delegate_fp32.h +++ b/mindspore/lite/src/runtime/kernel/cpu/fp32/convolution_delegate_fp32.h @@ -31,14 +31,17 @@ class ConvolutionDelegateCPUKernel : public LiteKernel { : LiteKernel(parameter, inputs, outputs, ctx) {} ~ConvolutionDelegateCPUKernel() override { FreeCopiedData(); - if (matmul_param_ != nullptr) { - matmul_param_ = nullptr; - } if (conv_kernel_ != nullptr) { + if (matmul_param_ != nullptr) { + free(op_parameter_); + } op_parameter_ = nullptr; // op_parameter will be freed in conv_kernel delete conv_kernel_; conv_kernel_ = nullptr; } + if (matmul_param_ != nullptr) { + matmul_param_ = nullptr; + } }; int Prepare() override; int ReSize() override;