fix invalid free

This commit is contained in:
yihaoDeng 2023-08-04 19:06:16 +08:00
parent 6a27e81964
commit 7396799d90
1 changed files with 7 additions and 5 deletions

View File

@ -296,12 +296,14 @@ _EXIT:
} }
void streamBackendCleanup(void* arg) { void streamBackendCleanup(void* arg) {
SBackendWrapper* pHandle = (SBackendWrapper*)arg; SBackendWrapper* pHandle = (SBackendWrapper*)arg;
RocksdbCfInst** pIter = (RocksdbCfInst**)taosHashIterate(pHandle->cfInst, NULL);
void* pIter = taosHashIterate(pHandle->cfInst, NULL);
while (pIter != NULL) { while (pIter != NULL) {
RocksdbCfInst* inst = *pIter; RocksdbCfInst* inst = *(RocksdbCfInst**)pIter;
destroyRocksdbCfInst(inst); destroyRocksdbCfInst(inst);
taosHashIterate(pHandle->cfInst, pIter); pIter = taosHashIterate(pHandle->cfInst, pIter);
} }
taosHashCleanup(pHandle->cfInst); taosHashCleanup(pHandle->cfInst);
if (pHandle->db) { if (pHandle->db) {
@ -1133,9 +1135,9 @@ int32_t streamStateOpenBackendCf(void* backend, char* name, char** cfs, int32_t
inst->pHandle[idx] = cfHandle[i]; inst->pHandle[idx] = cfHandle[i];
} }
} }
void** pIter = taosHashIterate(handle->cfInst, NULL); void* pIter = taosHashIterate(handle->cfInst, NULL);
while (pIter) { while (pIter) {
RocksdbCfInst* inst = *pIter; RocksdbCfInst* inst = *(RocksdbCfInst**)pIter;
for (int i = 0; i < cfLen; i++) { for (int i = 0; i < cfLen; i++) {
if (inst->cfOpt[i] == NULL) { if (inst->cfOpt[i] == NULL) {