提交 5d23c595 编写于 作者: A Alex Duan

fix(shell): coverity scan problem fixed add shellAuot.c

上级 fc5e4563
...@@ -533,26 +533,16 @@ void parseCommand(SWords * command, bool pattern) { ...@@ -533,26 +533,16 @@ void parseCommand(SWords * command, bool pattern) {
} }
// free Command // free Command
void freeCommand(SWords * command) { void freeCommand(SWords* command) {
SWord * word = command->head; SWord* item = command->head;
if (word == NULL) { // loop
return ; while (item) {
} SWord* tmp = item;
item = item->next;
// loop
while (word->next) {
SWord * tmp = word;
word = word->next;
// if malloc need free // if malloc need free
if(tmp->free && tmp->word) if (tmp->free && tmp->word) taosMemoryFree(tmp->word);
free(tmp->word); taosMemoryFree(tmp);
free(tmp);
} }
// if malloc need free
if(word->free && word->word)
free(word->word);
free(word);
} }
void GenerateVarType(int type, char** p, int count) { void GenerateVarType(int type, char** p, int count) {
...@@ -1178,11 +1168,11 @@ bool nextMatchCommand(TAOS * con, Command * cmd, SWords * firstMatch) { ...@@ -1178,11 +1168,11 @@ bool nextMatchCommand(TAOS * con, Command * cmd, SWords * firstMatch) {
printScreen(con, cmd, match); printScreen(con, cmd, match);
// free // free
freeCommand(input);
if (input->source) { if (input->source) {
free(input->source); free(input->source);
input->source = NULL; input->source = NULL;
} }
freeCommand(input);
free(input); free(input);
return true; return true;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册