fix: address sanitizer error
This commit is contained in:
parent
f41783c73f
commit
189c5cf137
|
@ -1712,11 +1712,11 @@ static int32_t fillIpRangesFromWhiteList(SAstCreateContext* pCxt, SNodeList* pIp
|
||||||
}
|
}
|
||||||
|
|
||||||
SNode* addCreateUserStmtWhiteList(SAstCreateContext* pCxt, SNode* pCreateUserStmt, SNodeList* pIpRangesNodeList) {
|
SNode* addCreateUserStmtWhiteList(SAstCreateContext* pCxt, SNode* pCreateUserStmt, SNodeList* pIpRangesNodeList) {
|
||||||
((SCreateUserStmt*)pCreateUserStmt)->pNodeListIpRanges = pIpRangesNodeList;
|
if (NULL == pCreateUserStmt || NULL == pIpRangesNodeList) {
|
||||||
|
|
||||||
if (pIpRangesNodeList == NULL) {
|
|
||||||
return pCreateUserStmt;
|
return pCreateUserStmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
((SCreateUserStmt*)pCreateUserStmt)->pNodeListIpRanges = pIpRangesNodeList;
|
||||||
SCreateUserStmt* pCreateUser = (SCreateUserStmt*)pCreateUserStmt;
|
SCreateUserStmt* pCreateUser = (SCreateUserStmt*)pCreateUserStmt;
|
||||||
pCreateUser->numIpRanges = LIST_LENGTH(pIpRangesNodeList);
|
pCreateUser->numIpRanges = LIST_LENGTH(pIpRangesNodeList);
|
||||||
pCreateUser->pIpRanges = taosMemoryMalloc(pCreateUser->numIpRanges * sizeof(SIpV4Range));
|
pCreateUser->pIpRanges = taosMemoryMalloc(pCreateUser->numIpRanges * sizeof(SIpV4Range));
|
||||||
|
|
|
@ -5712,10 +5712,12 @@ static int32_t translateCreateUser(STranslateContext* pCxt, SCreateUserStmt* pSt
|
||||||
createReq.sysInfo = pStmt->sysinfo;
|
createReq.sysInfo = pStmt->sysinfo;
|
||||||
createReq.enable = 1;
|
createReq.enable = 1;
|
||||||
strcpy(createReq.pass, pStmt->password);
|
strcpy(createReq.pass, pStmt->password);
|
||||||
|
|
||||||
createReq.numIpRanges = pStmt->numIpRanges;
|
createReq.numIpRanges = pStmt->numIpRanges;
|
||||||
createReq.pIpRanges = taosMemoryMalloc(createReq.numIpRanges * sizeof(SIpV4Range));
|
if (pStmt->numIpRanges > 0) {
|
||||||
memcpy(createReq.pIpRanges, pStmt->pIpRanges, sizeof(SIpV4Range) * createReq.numIpRanges);
|
createReq.pIpRanges = taosMemoryMalloc(createReq.numIpRanges * sizeof(SIpV4Range));
|
||||||
|
memcpy(createReq.pIpRanges, pStmt->pIpRanges, sizeof(SIpV4Range) * createReq.numIpRanges);
|
||||||
|
}
|
||||||
int32_t code = buildCmdMsg(pCxt, TDMT_MND_CREATE_USER, (FSerializeFunc)tSerializeSCreateUserReq, &createReq);
|
int32_t code = buildCmdMsg(pCxt, TDMT_MND_CREATE_USER, (FSerializeFunc)tSerializeSCreateUserReq, &createReq);
|
||||||
tFreeSCreateUserReq(&createReq);
|
tFreeSCreateUserReq(&createReq);
|
||||||
return code;
|
return code;
|
||||||
|
@ -5732,10 +5734,12 @@ static int32_t translateAlterUser(STranslateContext* pCxt, SAlterUserStmt* pStmt
|
||||||
if (NULL != pCxt->pParseCxt->db) {
|
if (NULL != pCxt->pParseCxt->db) {
|
||||||
snprintf(alterReq.objname, sizeof(alterReq.objname), "%s", pCxt->pParseCxt->db);
|
snprintf(alterReq.objname, sizeof(alterReq.objname), "%s", pCxt->pParseCxt->db);
|
||||||
}
|
}
|
||||||
alterReq.numIpRanges = pStmt->numIpRanges;
|
|
||||||
alterReq.pIpRanges = taosMemoryMalloc(alterReq.numIpRanges * sizeof(SIpV4Range));
|
|
||||||
memcpy(alterReq.pIpRanges, pStmt->pIpRanges, sizeof(SIpV4Range) * alterReq.numIpRanges);
|
|
||||||
|
|
||||||
|
alterReq.numIpRanges = pStmt->numIpRanges;
|
||||||
|
if (pStmt->numIpRanges > 0) {
|
||||||
|
alterReq.pIpRanges = taosMemoryMalloc(alterReq.numIpRanges * sizeof(SIpV4Range));
|
||||||
|
memcpy(alterReq.pIpRanges, pStmt->pIpRanges, sizeof(SIpV4Range) * alterReq.numIpRanges);
|
||||||
|
}
|
||||||
int32_t code = buildCmdMsg(pCxt, TDMT_MND_ALTER_USER, (FSerializeFunc)tSerializeSAlterUserReq, &alterReq);
|
int32_t code = buildCmdMsg(pCxt, TDMT_MND_ALTER_USER, (FSerializeFunc)tSerializeSAlterUserReq, &alterReq);
|
||||||
tFreeSAlterUserReq(&alterReq);
|
tFreeSAlterUserReq(&alterReq);
|
||||||
return code;
|
return code;
|
||||||
|
|
Loading…
Reference in New Issue