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