Author: Fabian Fagerholm <fabbe@debian.org>
Description: Exact description unknown; make sure mutex-related code works.
--- cyrus-sasl2.orig/lib/common.c
+++ cyrus-sasl2/lib/common.c
@@ -818,7 +818,7 @@ int _sasl_common_init(sasl_global_callba
     result = sasl_canonuser_add_plugin("INTERNAL", internal_canonuser_init);
     if(result != SASL_OK) return result;    
 
-    if (!free_mutex) {
+    if (!free_mutex || free_mutex == 0x1) {
 	free_mutex = sasl_MUTEX_ALLOC();
     }
     if (!free_mutex) return SASL_FAIL;
@@ -838,6 +838,11 @@ void sasl_dispose(sasl_conn_t **pconn)
 
   /* serialize disposes. this is necessary because we can't
      dispose of conn->mutex if someone else is locked on it */
+
+  if (!free_mutex || free_mutex == 0x1)
+    free_mutex = sasl_MUTEX_ALLOC();
+  if (!free_mutex) return SASL_FAIL;
+
   result = sasl_MUTEX_LOCK(free_mutex);
   if (result!=SASL_OK) return;
   
