From c491139a6e9245363600102609a8dd0569af66b4 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Mon, 30 Mar 2020 16:38:10 +0800 Subject: [PATCH] [TD-71] fix sqlstr uninitialized use issue. --- src/client/src/tscSub.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/client/src/tscSub.c b/src/client/src/tscSub.c index 610c119e6d..b9690e1888 100644 --- a/src/client/src/tscSub.c +++ b/src/client/src/tscSub.c @@ -104,6 +104,7 @@ static SSub* tscCreateSubscription(STscObj* pObj, const char* topic, const char* return NULL; } + char* sqlstr = NULL; SSqlObj* pSql = calloc(1, sizeof(SSqlObj)); if (pSql == NULL) { globalCode = TSDB_CODE_CLI_OUT_OF_MEMORY; @@ -114,7 +115,7 @@ static SSub* tscCreateSubscription(STscObj* pObj, const char* topic, const char* pSql->signature = pSql; pSql->pTscObj = pObj; - char* sqlstr = (char*)malloc(strlen(sql) + 1); + sqlstr = (char*)malloc(strlen(sql) + 1); if (sqlstr == NULL) { tscError("failed to allocate sql string for subscription"); goto failed; -- GitLab