fix: fix address sanitizer error

This commit is contained in:
slzhou 2023-09-19 09:35:30 +08:00
parent 05ef6e291c
commit c2cc59d7f3
1 changed files with 2 additions and 4 deletions

View File

@ -6849,7 +6849,7 @@ int tEncodeSVCreateTbReq(SEncoder *pCoder, const SVCreateTbReq *pReq) {
//ENCODESQL //ENCODESQL
if(pReq->sqlLen > 0 && pReq->sql != NULL) { if(pReq->sqlLen > 0 && pReq->sql != NULL) {
if (tEncodeI32(pCoder, pReq->sqlLen) < 0) return -1; if (tEncodeI32(pCoder, pReq->sqlLen) < 0) return -1;
if (tEncodeCStrWithLen(pCoder, pReq->sql, pReq->sqlLen) < 0) return -1; if (tEncodeBinary(pCoder, pReq->sql, pReq->sqlLen) < 0) return -1;
} }
tEndEncode(pCoder); tEndEncode(pCoder);
@ -6898,9 +6898,7 @@ int tDecodeSVCreateTbReq(SDecoder *pCoder, SVCreateTbReq *pReq) {
if(!tDecodeIsEnd(pCoder)){ if(!tDecodeIsEnd(pCoder)){
if(tDecodeI32(pCoder, &pReq->sqlLen) < 0) return -1; if(tDecodeI32(pCoder, &pReq->sqlLen) < 0) return -1;
if(pReq->sqlLen > 0){ if(pReq->sqlLen > 0){
pReq->sql = taosMemoryCalloc(1, pReq->sqlLen + 1); if (tDecodeBinaryAlloc(pCoder, (void**)&pReq->sql, NULL) < 0) return -1;
if (pReq->sql == NULL) return -1;
if (tDecodeCStrTo(pCoder, pReq->sql) < 0) return -1;
} }
} }