From 60188e82a6a686e08e2fd12d3e8132a68b92a8e3 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Tue, 28 Feb 2023 13:42:19 +0800 Subject: [PATCH] fix(query): fix coverity issue. --- source/dnode/vnode/src/tsdb/tsdbRead.c | 6 ++++-- source/libs/executor/src/executor.c | 2 +- source/libs/executor/src/executorimpl.c | 5 +++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index c0331f5513..bc162e8f63 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -874,8 +874,10 @@ static int32_t doLoadFileBlock(STsdbReader* pReader, SArray* pIndexList, SBlockN pBlockNum->numOfBlocks += 1; } - if ((pScanInfo->pBlockList != NULL )&& (taosArrayGetSize(pScanInfo->pBlockList) > 0)) { - numOfQTable += 1; + if (pScanInfo->pBlockList != NULL) { + if (taosArrayGetSize(pScanInfo->pBlockList) > 0) { + numOfQTable += 1; + } } } diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c index c599b479e6..ee0ae91cbd 100644 --- a/source/libs/executor/src/executor.c +++ b/source/libs/executor/src/executor.c @@ -471,7 +471,7 @@ int32_t qCreateExecTask(SReadHandle* readHandle, int32_t vgId, uint64_t taskId, if (handle) { void* pSinkParam = NULL; code = createDataSinkParam(pSubplan->pDataSink, &pSinkParam, pTaskInfo, readHandle); - if (code != TSDB_CODE_SUCCESS) { + if (code != TSDB_CODE_SUCCESS || pSinkParam == NULL) { qError("failed to createDataSinkParam, vgId:%d, code:%s, %s", vgId, tstrerror(code), (*pTask)->id.str); goto _error; } diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index dd12baede3..052c0d8c1e 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -2015,6 +2015,11 @@ SSchemaWrapper* extractQueriedColumnSchema(SScanPhysiNode* pScanNode); int32_t extractTableSchemaInfo(SReadHandle* pHandle, SScanPhysiNode* pScanNode, SExecTaskInfo* pTaskInfo) { SMetaReader mr = {0}; + if (pHandle == NULL) { + terrno = TSDB_CODE_INVALID_PARA; + return terrno; + } + metaReaderInit(&mr, pHandle->meta, 0); int32_t code = metaGetTableEntryByUidCache(&mr, pScanNode->uid); if (code != TSDB_CODE_SUCCESS) { -- GitLab