From ea497f20a3de943c03e017d999df0ac3ca7fb312 Mon Sep 17 00:00:00 2001 From: hjxilinx Date: Sat, 11 Apr 2020 23:37:50 +0800 Subject: [PATCH] [td-98] fix uninitialized value access warning by valgrind. --- src/kit/shell/src/shellEngine.c | 2 +- src/kit/shell/src/shellMain.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/kit/shell/src/shellEngine.c b/src/kit/shell/src/shellEngine.c index 0325e7f641..e291fdc551 100644 --- a/src/kit/shell/src/shellEngine.c +++ b/src/kit/shell/src/shellEngine.c @@ -284,7 +284,7 @@ void shellRunCommandOnServer(TAOS *con, char command[]) { /* Function to do regular expression check */ int regex_match(const char *s, const char *reg, int cflags) { regex_t regex; - char msgbuf[100]; + char msgbuf[100] = {0}; /* Compile regular expression */ if (regcomp(®ex, reg, cflags) != 0) { diff --git a/src/kit/shell/src/shellMain.c b/src/kit/shell/src/shellMain.c index a7b7e8383b..81a41453e8 100644 --- a/src/kit/shell/src/shellMain.c +++ b/src/kit/shell/src/shellMain.c @@ -97,6 +97,8 @@ int main(int argc, char* argv[]) { /* Interupt handler. */ struct sigaction act; + memset(&act, 0, sizeof(struct sigaction)); + act.sa_handler = interruptHandler; sigaction(SIGTERM, &act, NULL); sigaction(SIGINT, &act, NULL); -- GitLab