From 517f1f7e40b1ecb5ef086c0463e58a8a06f7a5ff Mon Sep 17 00:00:00 2001 From: Benguang Zhao Date: Tue, 12 Sep 2023 19:27:54 +0800 Subject: [PATCH] fixup: fix syncNodeOnSnapshotPrep --- source/libs/sync/src/syncSnapshot.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/libs/sync/src/syncSnapshot.c b/source/libs/sync/src/syncSnapshot.c index 00dcd7e949..73b6940628 100644 --- a/source/libs/sync/src/syncSnapshot.c +++ b/source/libs/sync/src/syncSnapshot.c @@ -605,15 +605,16 @@ _SEND_REPLY: // build msg ; // make complier happy - code = -1; SSnapshot snapInfo = {.typ = TAOS_SYNC_SNAP_INFO_DIFF}; int32_t dataLen = 0; if (pMsg->dataLen > 0) { void *data = taosMemoryCalloc(1, pMsg->dataLen); if (data == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; goto _out; } + dataLen = pMsg->dataLen; memcpy(data, pMsg->data, dataLen); snapInfo.data = data; data = NULL; @@ -627,6 +628,7 @@ _SEND_REPLY: SRpcMsg rpcMsg = {0}; if (syncBuildSnapshotSendRsp(&rpcMsg, dataLen, pSyncNode->vgId) != 0) { sRError(pReceiver, "snapshot receiver failed to build resp since %s", terrstr()); + code = terrno; goto _out; } @@ -650,10 +652,9 @@ _SEND_REPLY: syncLogSendSyncSnapshotRsp(pSyncNode, pRspMsg, "snapshot receiver pre-snapshot"); if (syncNodeSendMsgById(&pRspMsg->destId, pSyncNode, &rpcMsg) != 0) { sRError(pReceiver, "snapshot receiver failed to build resp since %s", terrstr()); - goto _out; + code = terrno; } - code = 0; _out: if (snapInfo.data) { taosMemoryFree(snapInfo.data);