forked from mindspore-Ecosystem/mindspore
!43382 [MSLITE][CPU] fuzz problem fix
Merge pull request !43382 from Greatpan/conv_fuzz_fix
This commit is contained in:
commit
6b67c22e32
|
@ -233,7 +233,7 @@ bool ConvolutionDelegateCPUKernel::CheckAvxUseSWConv(const ConvParameter *conv_p
|
|||
kernel::LiteKernel *ConvolutionDelegateCPUKernel::CreateConv1x1MatmulKernel() {
|
||||
auto conv_param = reinterpret_cast<ConvParameter *>(op_parameter_);
|
||||
|
||||
matmul_param_ = new (std::nothrow) MatMulParameter;
|
||||
matmul_param_ = reinterpret_cast<MatMulParameter *>(malloc(sizeof(MatMulParameter)));
|
||||
if (matmul_param_ == nullptr) {
|
||||
MS_LOG(WARNING) << "Memory allocation failed, Create Conv1x1 Matmul Kernel failed.";
|
||||
return nullptr;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue