forked from mindspore-Ecosystem/mindspore
conv fuzz fix
This commit is contained in:
parent
dd45074a1f
commit
7c0b4b4186
|
@ -233,7 +233,7 @@ bool ConvolutionDelegateCPUKernel::CheckAvxUseSWConv(const ConvParameter *conv_p
|
||||||
kernel::LiteKernel *ConvolutionDelegateCPUKernel::CreateConv1x1MatmulKernel() {
|
kernel::LiteKernel *ConvolutionDelegateCPUKernel::CreateConv1x1MatmulKernel() {
|
||||||
auto conv_param = reinterpret_cast<ConvParameter *>(op_parameter_);
|
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) {
|
if (matmul_param_ == nullptr) {
|
||||||
MS_LOG(WARNING) << "Memory allocation failed, Create Conv1x1 Matmul Kernel failed.";
|
MS_LOG(WARNING) << "Memory allocation failed, Create Conv1x1 Matmul Kernel failed.";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
|
@ -31,14 +31,17 @@ class ConvolutionDelegateCPUKernel : public LiteKernel {
|
||||||
: LiteKernel(parameter, inputs, outputs, ctx) {}
|
: LiteKernel(parameter, inputs, outputs, ctx) {}
|
||||||
~ConvolutionDelegateCPUKernel() override {
|
~ConvolutionDelegateCPUKernel() override {
|
||||||
FreeCopiedData();
|
FreeCopiedData();
|
||||||
if (matmul_param_ != nullptr) {
|
|
||||||
matmul_param_ = nullptr;
|
|
||||||
}
|
|
||||||
if (conv_kernel_ != nullptr) {
|
if (conv_kernel_ != nullptr) {
|
||||||
|
if (matmul_param_ != nullptr) {
|
||||||
|
free(op_parameter_);
|
||||||
|
}
|
||||||
op_parameter_ = nullptr; // op_parameter will be freed in conv_kernel
|
op_parameter_ = nullptr; // op_parameter will be freed in conv_kernel
|
||||||
delete conv_kernel_;
|
delete conv_kernel_;
|
||||||
conv_kernel_ = nullptr;
|
conv_kernel_ = nullptr;
|
||||||
}
|
}
|
||||||
|
if (matmul_param_ != nullptr) {
|
||||||
|
matmul_param_ = nullptr;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
int Prepare() override;
|
int Prepare() override;
|
||||||
int ReSize() override;
|
int ReSize() override;
|
||||||
|
|
Loading…
Reference in New Issue