From 4a7698d4aba5f94cc6f0e1bcadeefb52d2875d11 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Sat, 24 Jun 2023 00:41:05 +0800 Subject: [PATCH] fix(tsdb): add null ptr check. --- source/dnode/vnode/src/tsdb/tsdbMergeTree.c | 4 ++++ source/dnode/vnode/src/tsdb/tsdbRead2.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/source/dnode/vnode/src/tsdb/tsdbMergeTree.c b/source/dnode/vnode/src/tsdb/tsdbMergeTree.c index 7301338438..b8f368ed47 100644 --- a/source/dnode/vnode/src/tsdb/tsdbMergeTree.c +++ b/source/dnode/vnode/src/tsdb/tsdbMergeTree.c @@ -104,6 +104,10 @@ void *destroyLastBlockLoadInfo(SSttBlockLoadInfo *pLoadInfo) { } void destroySttBlockReader(SLDataIter* pLDataIter, int32_t numOfIter) { + if (pLDataIter == NULL) { + return; + } + for(int32_t i = 0; i < numOfIter; ++i) { tLDataIterClose2(&pLDataIter[i]); } diff --git a/source/dnode/vnode/src/tsdb/tsdbRead2.c b/source/dnode/vnode/src/tsdb/tsdbRead2.c index 692375200e..073baf44f6 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead2.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead2.c @@ -4791,6 +4791,7 @@ static void clearSharedPtr(STsdbReader* p) { p->pReadSnap = NULL; p->pSchema = NULL; p->pSchemaMap = NULL; + p->pfSetArray = NULL; } static void setSharedPtr(STsdbReader* pDst, const STsdbReader* pSrc) { @@ -4800,6 +4801,7 @@ static void setSharedPtr(STsdbReader* pDst, const STsdbReader* pSrc) { pDst->pSchema = pSrc->pSchema; pDst->pSchemaMap = pSrc->pSchemaMap; pDst->pReadSnap = pSrc->pReadSnap; + pDst->pfSetArray = pSrc->pfSetArray; if (pDst->pSchema) { tsdbRowMergerInit(&pDst->status.merger, pDst->pSchema); -- GitLab