fix: fix msg head issue

This commit is contained in:
dapan1121 2022-11-04 10:47:49 +08:00
parent 9ce099a2cf
commit 65636154ea
2 changed files with 4 additions and 2 deletions

View File

@ -466,7 +466,7 @@ static void *mndBuildVCreateStbReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pSt
contLen += sizeof(SMsgHead); contLen += sizeof(SMsgHead);
SMsgHead *pHead = taosMemoryMalloc(contLen); SMsgHead *pHead = taosMemoryCalloc(1, contLen);
if (pHead == NULL) { if (pHead == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY; terrno = TSDB_CODE_OUT_OF_MEMORY;
goto _err; goto _err;
@ -519,6 +519,7 @@ static void *mndBuildVDropStbReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pStb,
pHead->contLen = htonl(contLen); pHead->contLen = htonl(contLen);
pHead->vgId = htonl(pVgroup->vgId); pHead->vgId = htonl(pVgroup->vgId);
pHead->msgMask = htonl(0);
void *pBuf = POINTER_SHIFT(pHead, sizeof(SMsgHead)); void *pBuf = POINTER_SHIFT(pHead, sizeof(SMsgHead));

View File

@ -72,6 +72,7 @@ SSyncRaftEntry* syncEntryBuildNoop(SyncTerm term, SyncIndex index, int32_t vgId)
SMsgHead head; SMsgHead head;
head.vgId = vgId; head.vgId = vgId;
head.contLen = sizeof(SMsgHead); head.contLen = sizeof(SMsgHead);
head.msgMask = 0;
SRpcMsg rpcMsg; SRpcMsg rpcMsg;
memset(&rpcMsg, 0, sizeof(SRpcMsg)); memset(&rpcMsg, 0, sizeof(SRpcMsg));
rpcMsg.contLen = head.contLen; rpcMsg.contLen = head.contLen;