提交 ef7a25fd 编写于 作者: C Cary Xu

fix: fix the var data len

上级 9fab97a0
...@@ -1238,13 +1238,13 @@ int32_t tdSTSRowNew(SArray *pArray, STSchema *pTSchema, STSRow **ppRow) { ...@@ -1238,13 +1238,13 @@ int32_t tdSTSRowNew(SArray *pArray, STSchema *pTSchema, STSRow **ppRow) {
varDataLen += sizeof(VarDataLenT); varDataLen += sizeof(VarDataLenT);
if (pTColumn->type == TSDB_DATA_TYPE_VARCHAR) { if (pTColumn->type == TSDB_DATA_TYPE_VARCHAR) {
varDataLen += CHAR_BYTES; varDataLen += CHAR_BYTES;
if (maxVarDataLen < CHAR_BYTES) { if (maxVarDataLen < CHAR_BYTES + sizeof(VarDataLenT)) {
maxVarDataLen = CHAR_BYTES; maxVarDataLen = CHAR_BYTES + sizeof(VarDataLenT);
} }
} else { } else {
varDataLen += INT_BYTES; varDataLen += INT_BYTES;
if (maxVarDataLen < INT_BYTES) { if (maxVarDataLen < INT_BYTES + sizeof(VarDataLenT)) {
maxVarDataLen = INT_BYTES; maxVarDataLen = INT_BYTES + sizeof(VarDataLenT);
} }
} }
} }
...@@ -1263,7 +1263,7 @@ int32_t tdSTSRowNew(SArray *pArray, STSchema *pTSchema, STSRow **ppRow) { ...@@ -1263,7 +1263,7 @@ int32_t tdSTSRowNew(SArray *pArray, STSchema *pTSchema, STSRow **ppRow) {
} }
if (maxVarDataLen > 0) { if (maxVarDataLen > 0) {
varBuf = taosMemoryMalloc(maxVarDataLen + sizeof(VarDataLenT)); varBuf = taosMemoryMalloc(maxVarDataLen);
if (!varBuf) { if (!varBuf) {
taosMemoryFreeClear(*ppRow); taosMemoryFreeClear(*ppRow);
terrno = TSDB_CODE_OUT_OF_MEMORY; terrno = TSDB_CODE_OUT_OF_MEMORY;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册