$NetBSD: patch-ai,v 1.2 2015/04/26 11:37:08 ryoon Exp $

* Release connection->mutex before destroy it when
  connection->protection_level isn't TS_LEVEL3 since it causes destroying
  locked mutex when explicitly specifies "Threading" parameter in
  odbcinst.ini.  I don't know the case using LIBTHREAD.

--- DriverManager/__handles.c.orig	2013-06-06 14:34:38.000000000 +0000
+++ DriverManager/__handles.c
@@ -742,6 +742,8 @@ void __release_dbc( DMHDBC connection )
 
 #ifdef HAVE_LIBPTH
 #elif HAVE_LIBPTHREAD
+    if ( connection -> protection_level != TS_LEVEL3)
+       mutex_exit( &connection -> mutex );
     pthread_mutex_destroy( &connection -> mutex );
 #elif HAVE_LIBTHREAD
     mutex_destroy( &connection -> mutex );
