Merge pull request #25626 from taosdata/fix/TD-29872-3.0

fix: memory leak with cmd.command and buffer
This commit is contained in:
Alex Duan 2024-05-06 13:34:31 +08:00 committed by GitHub
commit 8d64a942f6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 0 deletions

View File

@ -488,6 +488,8 @@ int32_t shellReadCommand(char *command) {
c = taosGetConsoleChar();
if (c == (char)EOF) {
taosMemoryFreeClear(cmd.buffer);
taosMemoryFreeClear(cmd.command);
return c;
}
@ -524,6 +526,8 @@ int32_t shellReadCommand(char *command) {
case 4: // EOF or Ctrl+D
taosResetTerminalMode();
printf("\r\n");
taosMemoryFreeClear(cmd.buffer);
taosMemoryFreeClear(cmd.command);
return -1;
case 5: // ctrl E
shellPositionCursorEnd(&cmd);