From c4ea13d300fcf4988a5edf6f04e28a7ff8326651 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Wed, 25 Aug 2021 18:12:47 +0800 Subject: [PATCH] [TD-6167] fix memory leak --- src/client/src/tscPrepare.c | 10 +--------- src/client/src/tscSql.c | 2 +- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/client/src/tscPrepare.c b/src/client/src/tscPrepare.c index 12ae0ef8f5..1ecfc3993d 100644 --- a/src/client/src/tscPrepare.c +++ b/src/client/src/tscPrepare.c @@ -1503,14 +1503,6 @@ TAOS_STMT* taos_stmt_init(TAOS* taos) { return NULL; } - if (TSDB_CODE_SUCCESS != tscAllocPayload(&pSql->cmd, TSDB_DEFAULT_PAYLOAD_SIZE)) { - free(pSql); - free(pStmt); - terrno = TSDB_CODE_TSC_OUT_OF_MEMORY; - tscError("failed to malloc payload buffer"); - return NULL; - } - tsem_init(&pSql->rspSem, 0, 0); pSql->signature = pSql; pSql->pTscObj = pObj; @@ -1812,7 +1804,7 @@ int taos_stmt_close(TAOS_STMT* stmt) { } } - taos_free_result(pStmt->pSql); + tscFreeRegisteredSqlObj(pStmt->pSql)); tfree(pStmt); STMT_RET(TSDB_CODE_SUCCESS); } diff --git a/src/client/src/tscSql.c b/src/client/src/tscSql.c index 026c65a595..b55a6947fb 100644 --- a/src/client/src/tscSql.c +++ b/src/client/src/tscSql.c @@ -586,7 +586,7 @@ static bool tscKillQueryInDnode(SSqlObj* pSql) { tscBuildAndSendRequest(pSql, NULL); return false; } - + tscFreeRegisteredSqlObj return true; } -- GitLab