From fba5560f1bfb29e33bbdf43da8b8d22072eacf68 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Thu, 12 Sep 2024 14:24:11 +0800 Subject: [PATCH] fix(stmt2/close): wait asnyc cb completed to free itself --- source/client/src/clientStmt2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/client/src/clientStmt2.c b/source/client/src/clientStmt2.c index e7e08c0982..e716e06005 100644 --- a/source/client/src/clientStmt2.c +++ b/source/client/src/clientStmt2.c @@ -1667,7 +1667,6 @@ int stmtExec2(TAOS_STMT2* stmt, int* affected_rows) { STMT_ERR_RET(stmtCleanExecInfo(pStmt, (code ? false : true), false)); ++pStmt->sql.runTimes; - } else { SSqlCallbackWrapper* pWrapper = taosMemoryCalloc(1, sizeof(SSqlCallbackWrapper)); if (pWrapper == NULL) { @@ -1718,6 +1717,7 @@ int stmtClose2(TAOS_STMT2* stmt) { STMT_ERR_RET(stmtCleanSQLInfo(pStmt)); if (pStmt->options.asyncExecFn) { + (void)tsem_wait(&pStmt->asyncQuerySem); (void)tsem_destroy(&pStmt->asyncQuerySem); } taosMemoryFree(stmt);