From 6a18a238738d002fb8870660d5919953ec2055fb Mon Sep 17 00:00:00 2001 From: fang Date: Sat, 7 Dec 2019 18:00:10 +0800 Subject: [PATCH] resolve static check warnings --- src/client/src/tscAst.c | 2 +- src/client/src/tscJoinProcess.c | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/client/src/tscAst.c b/src/client/src/tscAst.c index 6e72fa8438..78948cabdc 100644 --- a/src/client/src/tscAst.c +++ b/src/client/src/tscAst.c @@ -326,8 +326,8 @@ static tSQLSyntaxNode *createSyntaxTree(SSchema *pSchema, int32_t numOfCols, cha uint8_t localOptr = getBinaryExprOptr(&t0); if (localOptr == 0) { pError("not support binary operator:%d", t0.type); - return NULL; free(pBinExpr) + return NULL; } return parseRemainStr(str, pBinExpr, pSchema, localOptr, numOfCols, i); diff --git a/src/client/src/tscJoinProcess.c b/src/client/src/tscJoinProcess.c index ed44d54066..e2c5bdbcab 100644 --- a/src/client/src/tscJoinProcess.c +++ b/src/client/src/tscJoinProcess.c @@ -733,6 +733,7 @@ STSBuf* tsBufCreateFromFile(const char* path, bool autoDelete) { pTSBuf->f = fopen(pTSBuf->path, "r"); if (pTSBuf->f == NULL) { + free(pTSBuf); return NULL; } @@ -774,7 +775,7 @@ STSBuf* tsBufCreateFromFile(const char* path, bool autoDelete) { size_t infoSize = sizeof(STSVnodeBlockInfo) * pTSBuf->numOfVnodes; STSVnodeBlockInfo* buf = (STSVnodeBlockInfo*)calloc(1, infoSize); - int64_t pos = ftell(pTSBuf->f); + //int64_t pos = ftell(pTSBuf->f); //pos not used fread(buf, infoSize, 1, pTSBuf->f); // the length value for each vnode is not kept in file, so does not set the length value @@ -1250,6 +1251,10 @@ bool tsBufNextPos(STSBuf* pTSBuf) { pCur->vnodeIndex = -1; return false; } + + if (pBlockInfo == NULL) { + return false; + } int32_t blockIndex = pCur->order == TSQL_SO_ASC ? 0 : pBlockInfo->numOfBlocks - 1; tsBufGetBlock(pTSBuf, pCur->vnodeIndex + step, blockIndex); -- GitLab