diff --git a/services/distributeddataservice/libs/distributeddb/communicator/src/serial_buffer.cpp b/services/distributeddataservice/libs/distributeddb/communicator/src/serial_buffer.cpp index 934ea3ec54d326b49a2b89c38a9bb417fb72fc48..24065e7888285b4e4dcfc9a30cc0faa258d6c75b 100644 --- a/services/distributeddataservice/libs/distributeddb/communicator/src/serial_buffer.cpp +++ b/services/distributeddataservice/libs/distributeddb/communicator/src/serial_buffer.cpp @@ -55,7 +55,7 @@ int SerialBuffer::AllocBufferByPayloadLength(uint32_t inPayloadLen, uint32_t inH if (totalLen_ == 0 || totalLen_ > MAX_TOTAL_LEN) { return -E_INVALID_ARGS; } - oringinalBytes_ = new (std::nothrow) uint8_t[totalLen_ + extendHeadLen_]; + oringinalBytes_ = new (std::nothrow) uint8_t[totalLen_ + extendHeadLen_](); if (oringinalBytes_ == nullptr) { return -E_OUT_OF_MEMORY; } @@ -77,7 +77,7 @@ int SerialBuffer::AllocBufferByTotalLength(uint32_t inTotalLen, uint32_t inHeade headerLen_ = inHeaderLen; payloadLen_ = totalLen_ - headerLen_; paddingLen_ = 0; - bytes_ = new (std::nothrow) uint8_t[inTotalLen]; + bytes_ = new (std::nothrow) uint8_t[inTotalLen](); if (bytes_ == nullptr) { return -E_OUT_OF_MEMORY; }