Merge pull request #26427 from taosdata/fix/cov
other: fix coverity issue.
This commit is contained in:
commit
b4f43fac87
|
@ -1759,6 +1759,7 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo*
|
|||
if (ps == NULL) {
|
||||
return terrno;
|
||||
}
|
||||
tsdbRowMergerInit(pMerger, ps);
|
||||
}
|
||||
|
||||
SRowKey minKey = k;
|
||||
|
@ -1842,6 +1843,7 @@ static int32_t mergeFileBlockAndSttBlock(STsdbReader* pReader, SSttBlockReader*
|
|||
if (ps == NULL) {
|
||||
return terrno;
|
||||
}
|
||||
tsdbRowMergerInit(pMerger, ps);
|
||||
}
|
||||
|
||||
bool dataInDataFile = hasDataInFileBlock(pBlockData, pDumpInfo);
|
||||
|
@ -1963,6 +1965,7 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo*
|
|||
if (ps == NULL) {
|
||||
return terrno;
|
||||
}
|
||||
tsdbRowMergerInit(pMerger, ps);
|
||||
}
|
||||
|
||||
SRowKey minKey = k;
|
||||
|
@ -2326,6 +2329,7 @@ int32_t mergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pBloc
|
|||
if (ps == NULL) {
|
||||
return terrno;
|
||||
}
|
||||
tsdbRowMergerInit(pMerger, ps);
|
||||
}
|
||||
|
||||
tRowKeyAssign(&pBlockScanInfo->lastProcKey, pKey);
|
||||
|
|
|
@ -3459,11 +3459,15 @@ static int32_t tagScanFilterByTagCond(SArray* aUidTags, SNode* pTagCond, SArray*
|
|||
SScalarParam output = {0};
|
||||
code = tagScanCreateResultData(&type, numOfTables, &output);
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
blockDataDestroy(pResBlock);
|
||||
taosArrayDestroy(pBlockList);
|
||||
return code;
|
||||
}
|
||||
|
||||
code = scalarCalculate(pTagCond, pBlockList, &output);
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
blockDataDestroy(pResBlock);
|
||||
taosArrayDestroy(pBlockList);
|
||||
return code;
|
||||
}
|
||||
|
||||
|
|
|
@ -238,6 +238,9 @@ int32_t remoteChkp_readMetaData(char* path, SArray* list) {
|
|||
sprintf(metaPath, "%s%s%s", path, TD_DIRSEP, "META");
|
||||
|
||||
TdFilePtr pFile = taosOpenFile(path, TD_FILE_READ);
|
||||
if (pFile == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
char buf[128] = {0};
|
||||
if (taosReadFile(pFile, buf, sizeof(buf)) <= 0) {
|
||||
|
@ -245,7 +248,8 @@ int32_t remoteChkp_readMetaData(char* path, SArray* list) {
|
|||
taosCloseFile(&pFile);
|
||||
return -1;
|
||||
}
|
||||
int32_t len = strlen(buf);
|
||||
|
||||
int32_t len = strnlen(buf, tListLen(buf));
|
||||
for (int i = 0; i < len; i++) {
|
||||
if (buf[i] == '\n') {
|
||||
char* item = taosMemoryCalloc(1, i + 1);
|
||||
|
@ -2117,9 +2121,7 @@ void taskDbDestroy(void* pDb, bool flush) {
|
|||
|
||||
stDebug("succ to destroy stream backend:%p", wrapper);
|
||||
|
||||
int8_t nCf = sizeof(ginitDict) / sizeof(ginitDict[0]);
|
||||
|
||||
if (wrapper == NULL) return;
|
||||
int8_t nCf = tListLen(ginitDict);
|
||||
|
||||
if (flush) {
|
||||
if (wrapper->db && wrapper->pCf) {
|
||||
|
@ -4223,7 +4225,8 @@ int32_t dbChkpDumpTo(SDbChkp* p, char* dname, SArray* list) {
|
|||
|
||||
static char* chkpMeta = "META";
|
||||
memset(dstBuf, 0, len);
|
||||
sprintf(dstDir, "%s%s%s", dstDir, TD_DIRSEP, chkpMeta);
|
||||
sprintf(dstBuf, "%s%s%s", dstDir, TD_DIRSEP, chkpMeta);
|
||||
tstrncpy(dstDir, dstBuf, strlen(dstBuf) + 1);
|
||||
|
||||
TdFilePtr pFile = taosOpenFile(dstDir, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC);
|
||||
if (pFile == NULL) {
|
||||
|
|
|
@ -312,17 +312,12 @@ int32_t streamSnapHandleInit(SStreamSnapHandle* pHandle, char* path, void* pMeta
|
|||
ASSERT(code == 0);
|
||||
taosArrayPush(pDbSnapSet, &snapFile);
|
||||
}
|
||||
|
||||
pHandle->pDbSnapSet = pDbSnapSet;
|
||||
pHandle->pSnapInfoSet = pSnapInfoSet;
|
||||
pHandle->currIdx = 0;
|
||||
pHandle->pMeta = pMeta;
|
||||
return 0;
|
||||
|
||||
_err:
|
||||
streamSnapHandleDestroy(pHandle);
|
||||
|
||||
code = -1;
|
||||
return code;
|
||||
}
|
||||
|
||||
void streamSnapHandleDestroy(SStreamSnapHandle* handle) {
|
||||
|
@ -444,6 +439,7 @@ _NEXT:
|
|||
pSnapFile = taosArrayGet(pHandle->pDbSnapSet, pHandle->currIdx);
|
||||
goto _NEXT;
|
||||
} else {
|
||||
taosMemoryFree(buf);
|
||||
*ppData = NULL;
|
||||
*size = 0;
|
||||
return 0;
|
||||
|
@ -465,7 +461,9 @@ _NEXT:
|
|||
pHdr->totalSize = item->size;
|
||||
pHdr->snapInfo = pSnapFile->snapInfo;
|
||||
|
||||
memcpy(pHdr->name, item->name, strlen(item->name));
|
||||
int32_t len = TMIN(strlen(item->name), tListLen(pHdr->name));
|
||||
memcpy(pHdr->name, item->name, len);
|
||||
|
||||
pSnapFile->seraial += nread;
|
||||
|
||||
*ppData = buf;
|
||||
|
|
Loading…
Reference in New Issue