Merge pull request #17138 from taosdata/fix/3.0_bugfix_wxy
fix: very long string serialization problem
This commit is contained in:
commit
7e4c32784e
|
@ -90,12 +90,12 @@ static void endTlvEncode(STlvEncoder* pEncoder, char** pMsg, int32_t* pLen) {
|
|||
static int32_t tlvEncodeImpl(STlvEncoder* pEncoder, int16_t type, const void* pValue, int32_t len) {
|
||||
int32_t tlvLen = sizeof(STlv) + len;
|
||||
if (pEncoder->offset + tlvLen > pEncoder->allocSize) {
|
||||
void* pNewBuf = taosMemoryRealloc(pEncoder->pBuf, pEncoder->allocSize * 2);
|
||||
pEncoder->allocSize = TMAX(pEncoder->allocSize * 2, pEncoder->allocSize + pEncoder->offset + tlvLen);
|
||||
void* pNewBuf = taosMemoryRealloc(pEncoder->pBuf, pEncoder->allocSize);
|
||||
if (NULL == pNewBuf) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
pEncoder->pBuf = pNewBuf;
|
||||
pEncoder->allocSize = pEncoder->allocSize * 2;
|
||||
}
|
||||
STlv* pTlv = (STlv*)(pEncoder->pBuf + pEncoder->offset);
|
||||
pTlv->type = htons(type);
|
||||
|
|
Loading…
Reference in New Issue