conv fuzz fix

This commit is contained in:
greatpanc 2022-10-09 09:09:22 +08:00
parent dd45074a1f
commit 7c0b4b4186
2 changed files with 7 additions and 4 deletions

View File

@ -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;

View File

@ -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;