From a81de6e06c83d8f283fd789218b44a53793c735c Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Fri, 15 Mar 2024 14:53:13 +0800 Subject: [PATCH] fix: change stack to malloc reduce memory --- tools/shell/src/shellEngine.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/shell/src/shellEngine.c b/tools/shell/src/shellEngine.c index 40d41a560a..8c78a94de6 100644 --- a/tools/shell/src/shellEngine.c +++ b/tools/shell/src/shellEngine.c @@ -1152,7 +1152,7 @@ void shellSourceFile(const char *file) { bool shellGetGrantInfo(char* buf) { bool community = true; - char sinfo[128] = {0}; + char sinfo[256] = {0}; tstrncpy(sinfo, taos_get_server_info(shell.conn), sizeof(sinfo)); strtok(sinfo, "\r\n"); @@ -1368,7 +1368,7 @@ int32_t shellExecute() { #ifdef WEBSOCKET if (!shell.args.restful && !shell.args.cloud) { #endif -char buf[356] = ""; +char* buf = taosMemoryMalloc(512); bool community = shellGetGrantInfo(buf); #ifndef WINDOWS printfIntroduction(community); @@ -1383,6 +1383,7 @@ bool community = shellGetGrantInfo(buf); if(!community) { printf("%s\n", buf); } +taosMemoryFree(buf); #ifdef WEBSOCKET }