提交 0e1c6aaf 编写于 作者: H Hongze Cheng

fix coverity scan problems

上级 6b58cbc2
...@@ -124,6 +124,7 @@ SListNode *tsdbAllocBufBlockFromPool(STsdbRepo *pRepo) { ...@@ -124,6 +124,7 @@ SListNode *tsdbAllocBufBlockFromPool(STsdbRepo *pRepo) {
} }
SListNode * pNode = tdListPopHead(pBufPool->bufBlockList); SListNode * pNode = tdListPopHead(pBufPool->bufBlockList);
ASSERT(pNode != NULL);
STsdbBufBlock *pBufBlock = NULL; STsdbBufBlock *pBufBlock = NULL;
tdListNodeGetData(pBufPool->bufBlockList, pNode, (void *)(&pBufBlock)); tdListNodeGetData(pBufPool->bufBlockList, pNode, (void *)(&pBufBlock));
......
...@@ -358,7 +358,9 @@ void tsdbRemoveFileGroup(STsdbRepo *pRepo, SFileGroup *pFGroup) { ...@@ -358,7 +358,9 @@ void tsdbRemoveFileGroup(STsdbRepo *pRepo, SFileGroup *pFGroup) {
ASSERT(pFileH->nFGroups >= 0); ASSERT(pFileH->nFGroups >= 0);
for (int type = TSDB_FILE_TYPE_HEAD; type < TSDB_FILE_TYPE_MAX; type++) { for (int type = TSDB_FILE_TYPE_HEAD; type < TSDB_FILE_TYPE_MAX; type++) {
remove(fileGroup.files[type].fname); if (remove(fileGroup.files[type].fname) < 0) {
tsdbError("vgId:%d failed to remove file %s", REPO_ID(pRepo), fileGroup.files[type].fname);
}
tsdbDestroyFile(&fileGroup.files[type]); tsdbDestroyFile(&fileGroup.files[type]);
} }
} }
......
...@@ -237,12 +237,13 @@ uint32_t tsdbGetFileInfo(TSDB_REPO_T *repo, char *name, uint32_t *index, uint32_ ...@@ -237,12 +237,13 @@ uint32_t tsdbGetFileInfo(TSDB_REPO_T *repo, char *name, uint32_t *index, uint32_
} }
SFile *pFile = &pFGroup->files[(*index) % 3]; SFile *pFile = &pFGroup->files[(*index) % 3];
strcpy(fname, pFile->fname); fname = strdup(pFile->fname);
} }
} }
if (stat(fname, &fState) < 0) { if (stat(fname, &fState) < 0) {
tfree(sdup); tfree(sdup);
tfree(fname);
return 0; return 0;
} }
...@@ -566,7 +567,7 @@ static int32_t tsdbSaveConfig(char *rootDir, STsdbCfg *pCfg) { ...@@ -566,7 +567,7 @@ static int32_t tsdbSaveConfig(char *rootDir, STsdbCfg *pCfg) {
_err: _err:
tfree(fname); tfree(fname);
if (fd > 0) close(fd); if (fd >= 0) close(fd);
return -1; return -1;
} }
...@@ -609,7 +610,7 @@ static int tsdbLoadConfig(char *rootDir, STsdbCfg *pCfg) { ...@@ -609,7 +610,7 @@ static int tsdbLoadConfig(char *rootDir, STsdbCfg *pCfg) {
_err: _err:
tfree(fname); tfree(fname);
if (fd > 0) close(fd); if (fd >= 0) close(fd);
return -1; return -1;
} }
......
...@@ -524,8 +524,6 @@ static int tsdbCommitToFile(STsdbRepo *pRepo, int fid, SCommitIter *iters, SRWHe ...@@ -524,8 +524,6 @@ static int tsdbCommitToFile(STsdbRepo *pRepo, int fid, SCommitIter *iters, SRWHe
goto _err; goto _err;
} }
free(dataDir);
// Open files for write/read // Open files for write/read
if (tsdbSetAndOpenHelperFile(pHelper, pGroup) < 0) { if (tsdbSetAndOpenHelperFile(pHelper, pGroup) < 0) {
tsdbError("vgId:%d failed to set helper file since %s", REPO_ID(pRepo), tstrerror(terrno)); tsdbError("vgId:%d failed to set helper file since %s", REPO_ID(pRepo), tstrerror(terrno));
...@@ -599,7 +597,7 @@ static int tsdbCommitToFile(STsdbRepo *pRepo, int fid, SCommitIter *iters, SRWHe ...@@ -599,7 +597,7 @@ static int tsdbCommitToFile(STsdbRepo *pRepo, int fid, SCommitIter *iters, SRWHe
return 0; return 0;
_err: _err:
// ASSERT(false); tfree(dataDir);
tsdbCloseHelperFile(pHelper, 1); tsdbCloseHelperFile(pHelper, 1);
return -1; return -1;
} }
......
...@@ -147,6 +147,7 @@ int tsdbDropTable(TSDB_REPO_T *repo, STableId tableId) { ...@@ -147,6 +147,7 @@ int tsdbDropTable(TSDB_REPO_T *repo, STableId tableId) {
tsdbInsertTableAct(pRepo, TSDB_DROP_META, buf, tTable); tsdbInsertTableAct(pRepo, TSDB_DROP_META, buf, tTable);
tsdbRemoveTableFromMeta(pRepo, tTable, false, true); tsdbRemoveTableFromMeta(pRepo, tTable, false, true);
} }
tSkipListDestroyIter(pIter);
} }
tsdbRemoveTableFromMeta(pRepo, pTable, true, true); tsdbRemoveTableFromMeta(pRepo, pTable, true, true);
...@@ -270,7 +271,6 @@ STableCfg *tsdbCreateTableCfgFromMsg(SMDCreateTableMsg *pMsg) { ...@@ -270,7 +271,6 @@ STableCfg *tsdbCreateTableCfgFromMsg(SMDCreateTableMsg *pMsg) {
_err: _err:
tdDestroyTSchemaBuilder(&schemaBuilder); tdDestroyTSchemaBuilder(&schemaBuilder);
tsdbClearTableCfg(pCfg); tsdbClearTableCfg(pCfg);
tfree(pCfg);
return NULL; return NULL;
} }
...@@ -309,6 +309,7 @@ int tsdbUpdateTagValue(TSDB_REPO_T *repo, SUpdateTableTagValMsg *pMsg) { ...@@ -309,6 +309,7 @@ int tsdbUpdateTagValue(TSDB_REPO_T *repo, SUpdateTableTagValMsg *pMsg) {
int32_t code = tsdbUpdateTable(pRepo, super, pTableCfg); int32_t code = tsdbUpdateTable(pRepo, super, pTableCfg);
if (code != TSDB_CODE_SUCCESS) { if (code != TSDB_CODE_SUCCESS) {
tsdbClearTableCfg(pTableCfg);
return code; return code;
} }
tsdbClearTableCfg(pTableCfg); tsdbClearTableCfg(pTableCfg);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册