fix(tsdb): check null ptr when un-referencing snapshot.

This commit is contained in:
Haojun Liao 2024-08-13 15:22:06 +08:00
parent 3701ded767
commit 14a2360f5e
1 changed files with 4 additions and 1 deletions

View File

@ -5827,9 +5827,12 @@ int32_t tsdbTakeReadSnap2(STsdbReader* pReader, _query_reseek_func_t reseek, STs
pSnap->pIMem = pTsdb->imem;
pSnap->pINode = taosMemoryMalloc(sizeof(*pSnap->pINode));
if (pSnap->pINode == NULL) {
tsdbUnrefMemTable(pTsdb->mem, pSnap->pNode, true); // unref the previous refed mem
code = terrno;
if (pTsdb->mem && pSnap->pNode) {
tsdbUnrefMemTable(pTsdb->mem, pSnap->pNode, true); // unref the previous refed mem
}
(void) taosThreadMutexUnlock(&pTsdb->mutex);
goto _exit;
}