Hotfix/sangshuduo/td 3197 taosdemo coverity scan for master (#6725)

* [TD-3197]<fix>: taosdemo and taosdump coverity scan issues.

* exit if read sample file failed.

Co-authored-by: Shuduo Sang <sdsang@taosdata.com>
This commit is contained in:
Shuduo Sang 2021-07-02 22:52:21 +08:00 committed by GitHub
parent 93b9371ee8
commit 4cc087ecb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 3 deletions

View File

@ -4702,16 +4702,20 @@ PARSE_OVER:
return ret; return ret;
} }
static void prepareSampleData() { static int prepareSampleData() {
for (int i = 0; i < g_Dbs.dbCount; i++) { for (int i = 0; i < g_Dbs.dbCount; i++) {
for (int j = 0; j < g_Dbs.db[i].superTblCount; j++) { for (int j = 0; j < g_Dbs.db[i].superTblCount; j++) {
if (g_Dbs.db[i].superTbls[j].tagsFile[0] != 0) { if (g_Dbs.db[i].superTbls[j].tagsFile[0] != 0) {
(void)readTagFromCsvFileToMem(&g_Dbs.db[i].superTbls[j]); if (readTagFromCsvFileToMem(&g_Dbs.db[i].superTbls[j]) != 0) {
return -1;
} }
} }
} }
} }
return 0;
}
static void postFreeResource() { static void postFreeResource() {
tmfclose(g_fpOfInsertResult); tmfclose(g_fpOfInsertResult);
for (int i = 0; i < g_Dbs.dbCount; i++) { for (int i = 0; i < g_Dbs.dbCount; i++) {
@ -6771,7 +6775,11 @@ static int insertTestProcess() {
} }
// pretreatement // pretreatement
prepareSampleData(); if (prepareSampleData() != 0) {
if (g_fpOfInsertResult)
fclose(g_fpOfInsertResult);
return -1;
}
double start; double start;
double end; double end;