Index: lib/libc/iconv/citrus_mapper.c
===================================================================
--- lib/libc/iconv/citrus_mapper.c	(revision 256803)
+++ lib/libc/iconv/citrus_mapper.c	(working copy)
@@ -341,14 +341,15 @@ _citrus_mapper_open(struct _citrus_mappe
 	/* open mapper */
 	UNLOCK(&cm_lock);
 	ret = mapper_open(ma, &cm, module, variable);
-	WLOCK(&cm_lock);
 	if (ret)
-		goto quit;
+		goto quit_unlocked;
+	WLOCK(&cm_lock);
 	cm->cm_key = strdup(mapname);
 	if (cm->cm_key == NULL) {
 		ret = errno;
+		UNLOCK(&cm_lock);
 		_mapper_close(cm);
-		goto quit;	
+		goto quit_unlocked;
 	}
 
 	/* insert to the cache */
@@ -359,7 +360,7 @@ _citrus_mapper_open(struct _citrus_mappe
 	ret = 0;
 quit:
 	UNLOCK(&cm_lock);
-
+quit_unlocked:
 	return (ret);
 }
 
@@ -381,7 +382,9 @@ _citrus_mapper_close(struct _citrus_mapp
 			_CITRUS_HASH_REMOVE(cm, cm_entry);
 			free(cm->cm_key);
 		}
+		UNLOCK(&cm_lock);
 		mapper_close(cm);
+		return;
 quit:
 		UNLOCK(&cm_lock);
 	}
