From 55f62de3ff9ed3e88a92ab55f93c5b1b4e68bc6e Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Wed, 31 May 2023 09:15:17 +0800 Subject: [PATCH] fix: call taos_free_result after reference finished --- src/benchQuery.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/benchQuery.c b/src/benchQuery.c index d90eace5..0acb6ecb 100644 --- a/src/benchQuery.c +++ b/src/benchQuery.c @@ -43,7 +43,6 @@ int selectAndGetResult(threadInfo *pThreadInfo, char *command) { TAOS_RES *res = taos_query(taos, command); int code = taos_errno(res); if (res == NULL || code) { - taos_free_result(res); if (YES_IF_FAILED == g_arguments->continueIfFail) { warnPrint("failed to execute sql:%s, " "code: 0x%08x, reason:%s\n", @@ -113,7 +112,6 @@ static void *mixedQuery(void *sarg) { TAOS_RES *res = taos_query(pThreadInfo->conn->taos, sql->command); if (res == NULL || taos_errno(res) != 0) { - taos_free_result(res); if (YES_IF_FAILED == g_arguments->continueIfFail) { warnPrint( "thread[%d]: failed to execute sql :%s, " @@ -130,9 +128,11 @@ static void *mixedQuery(void *sarg) { taos_errno(res), taos_errstr(res)); if (TSDB_CODE_RPC_NETWORK_UNAVAIL == taos_errno(res)) { + taos_free_result(res); return NULL; } } + taos_free_result(res); continue; } taos_free_result(res);