Initialize arenas_tsd before setting it.

Reported by: Ethan Burns, Rich Prohaska, Tudor Bosman
diff --git a/src/jemalloc.c b/src/jemalloc.c
index fd8bf52..fd6b890 100644
--- a/src/jemalloc.c
+++ b/src/jemalloc.c
@@ -769,6 +769,14 @@
 	}
 #endif
 
+	if (malloc_mutex_init(&arenas_lock))
+		return (true);
+
+	if (pthread_key_create(&arenas_tsd, arenas_cleanup) != 0) {
+		malloc_mutex_unlock(&init_lock);
+		return (true);
+	}
+
 	/*
 	 * Create enough scaffolding to allow recursive allocation in
 	 * malloc_ncpus().
@@ -795,14 +803,6 @@
 	ARENA_SET(arenas[0]);
 	arenas[0]->nthreads++;
 
-	if (malloc_mutex_init(&arenas_lock))
-		return (true);
-
-	if (pthread_key_create(&arenas_tsd, arenas_cleanup) != 0) {
-		malloc_mutex_unlock(&init_lock);
-		return (true);
-	}
-
 #ifdef JEMALLOC_PROF
 	if (prof_boot2()) {
 		malloc_mutex_unlock(&init_lock);