Index: driver/handle.c =================================================================== --- driver/handle.c (revision 955) +++ driver/handle.c (working copy) @@ -307,7 +307,9 @@ #endif /* IS UNIX */ stmt= (STMT FAR*) *phstmt; stmt->dbc= dbc; + pthread_mutex_lock(&stmt->dbc->lock); dbc->statements= list_add(dbc->statements,&stmt->list); + pthread_mutex_unlock(&stmt->dbc->lock); stmt->list.data= stmt; stmt->stmt_options= dbc->stmt_options; stmt->state= ST_UNKNOWN; @@ -471,7 +473,9 @@ x_free(stmt->cursor.name); x_free(stmt->bind); delete_dynamic(&stmt->params); + pthread_mutex_lock(&stmt->dbc->lock); stmt->dbc->statements= list_delete(stmt->dbc->statements,&stmt->list); + pthread_mutex_unlock(&stmt->dbc->lock); #ifndef _UNIX_ GlobalUnlock(GlobalHandle ((HGLOBAL) hstmt)); GlobalFree(GlobalHandle((HGLOBAL) hstmt)); Index: ChangeLog =================================================================== --- ChangeLog (revision 955) +++ ChangeLog (working copy) @@ -5,6 +5,8 @@ Bugs fixed: * Allowed connections to be enlisted in distributed transactions, even though the driver doesn't support them. (Bug #32727) + * Fixed thread synchronization bug in SQLAllocStmt()/SQLFreeStmt() + functions. (Bug #32857) ----