fix: heap-use-after-free while alter vnode replicas

This commit is contained in:
Shengliang Guan 2022-12-21 17:33:34 +08:00
parent 510ad2e39e
commit 6e7e3139b1
1 changed files with 4 additions and 4 deletions

View File

@ -1294,10 +1294,6 @@ void syncNodeClose(SSyncNode* pSyncNode) {
syncNodeStopElectTimer(pSyncNode);
syncNodeStopHeartbeatTimer(pSyncNode);
if (pSyncNode->pFsm != NULL) {
taosMemoryFree(pSyncNode->pFsm);
}
for (int32_t i = 0; i < TSDB_MAX_REPLICA; ++i) {
if ((pSyncNode->senders)[i] != NULL) {
sSTrace((pSyncNode->senders)[i], "snapshot sender destroy while close, data:%p", (pSyncNode->senders)[i]);
@ -1320,6 +1316,10 @@ void syncNodeClose(SSyncNode* pSyncNode) {
pSyncNode->pNewNodeReceiver = NULL;
}
if (pSyncNode->pFsm != NULL) {
taosMemoryFree(pSyncNode->pFsm);
}
taosMemoryFree(pSyncNode);
}