fix(stmt2/close): wait asnyc cb completed to free itself
This commit is contained in:
parent
9eeec14f7e
commit
fba5560f1b
|
@ -1667,7 +1667,6 @@ int stmtExec2(TAOS_STMT2* stmt, int* affected_rows) {
|
||||||
STMT_ERR_RET(stmtCleanExecInfo(pStmt, (code ? false : true), false));
|
STMT_ERR_RET(stmtCleanExecInfo(pStmt, (code ? false : true), false));
|
||||||
|
|
||||||
++pStmt->sql.runTimes;
|
++pStmt->sql.runTimes;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
SSqlCallbackWrapper* pWrapper = taosMemoryCalloc(1, sizeof(SSqlCallbackWrapper));
|
SSqlCallbackWrapper* pWrapper = taosMemoryCalloc(1, sizeof(SSqlCallbackWrapper));
|
||||||
if (pWrapper == NULL) {
|
if (pWrapper == NULL) {
|
||||||
|
@ -1718,6 +1717,7 @@ int stmtClose2(TAOS_STMT2* stmt) {
|
||||||
STMT_ERR_RET(stmtCleanSQLInfo(pStmt));
|
STMT_ERR_RET(stmtCleanSQLInfo(pStmt));
|
||||||
|
|
||||||
if (pStmt->options.asyncExecFn) {
|
if (pStmt->options.asyncExecFn) {
|
||||||
|
(void)tsem_wait(&pStmt->asyncQuerySem);
|
||||||
(void)tsem_destroy(&pStmt->asyncQuerySem);
|
(void)tsem_destroy(&pStmt->asyncQuerySem);
|
||||||
}
|
}
|
||||||
taosMemoryFree(stmt);
|
taosMemoryFree(stmt);
|
||||||
|
|
Loading…
Reference in New Issue