未验证 提交 056b7d6e 编写于 作者: sangshuduo's avatar sangshuduo 提交者: GitHub

fix few coverity scan issues. (#8005)

* fix few coverity scan issues.

* submit empty for triage appveyor build
上级 1b9ed345
...@@ -262,6 +262,8 @@ static struct argp_option options[] = { ...@@ -262,6 +262,8 @@ static struct argp_option options[] = {
{0} {0}
}; };
#define HUMAN_TIME_LEN 28
/* Used by main to communicate with parse_opt. */ /* Used by main to communicate with parse_opt. */
typedef struct arguments { typedef struct arguments {
// connection option // connection option
...@@ -285,9 +287,9 @@ typedef struct arguments { ...@@ -285,9 +287,9 @@ typedef struct arguments {
bool with_property; bool with_property;
bool avro; bool avro;
int64_t start_time; int64_t start_time;
char humanStartTime[28]; char humanStartTime[HUMAN_TIME_LEN];
int64_t end_time; int64_t end_time;
char humanEndTime[28]; char humanEndTime[HUMAN_TIME_LEN];
char precision[8]; char precision[8];
int32_t data_batch; int32_t data_batch;
...@@ -681,9 +683,9 @@ static void parse_args( ...@@ -681,9 +683,9 @@ static void parse_args(
static void copyHumanTimeToArg(char *timeStr, bool isStartTime) static void copyHumanTimeToArg(char *timeStr, bool isStartTime)
{ {
if (isStartTime) if (isStartTime)
strcpy(g_args.humanStartTime, timeStr); tstrncpy(g_args.humanStartTime, timeStr, HUMAN_TIME_LEN);
else else
strcpy(g_args.humanEndTime, timeStr); tstrncpy(g_args.humanEndTime, timeStr, HUMAN_TIME_LEN);
} }
static void copyTimestampToArg(char *timeStr, bool isStartTime) static void copyTimestampToArg(char *timeStr, bool isStartTime)
...@@ -719,6 +721,8 @@ static void parse_timestamp( ...@@ -719,6 +721,8 @@ static void parse_timestamp(
} else { } else {
copyTimestampToArg(tmp, isStartTime); copyTimestampToArg(tmp, isStartTime);
} }
free(tmp);
} }
} }
} }
...@@ -1205,6 +1209,7 @@ static int inDatabasesSeq( ...@@ -1205,6 +1209,7 @@ static int inDatabasesSeq(
dbname = strsep(&running, ","); dbname = strsep(&running, ",");
} }
free(dupSeq);
} }
return -1; return -1;
...@@ -1295,6 +1300,7 @@ static int taosDumpOut() { ...@@ -1295,6 +1300,7 @@ static int taosDumpOut() {
g_args.dbCount = getDbCount(); g_args.dbCount = getDbCount();
if (0 == g_args.dbCount) { if (0 == g_args.dbCount) {
fclose(fp);
errorPrint("%d databases valid to dump\n", g_args.dbCount); errorPrint("%d databases valid to dump\n", g_args.dbCount);
return -1; return -1;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册