libc - Fix bogus pthread_getspecific() return value due to bug in nmalloc
authorMatthew Dillon <dillon@apollo.backplane.com>
Sun, 30 Jan 2011 21:44:11 +0000 (13:44 -0800)
committerMatthew Dillon <dillon@apollo.backplane.com>
Sun, 30 Jan 2011 21:44:11 +0000 (13:44 -0800)
commit909fda640a31a4774cfaefe59eedbf7fc1608afc
treeba9e5914e84b0865a362c2d90ca10f62ef5e0b5a
parent1b5059791e18ddddcdcbd8857a6d8ab94c5e0ce1
libc - Fix bogus pthread_getspecific() return value due to bug in nmalloc

* nmalloc was calling pthread_set_specific() prior to calling
  pthread_key_create(), causing it to use key 0 which might already
  have been allocated for other purposes.

* Reorder initializations in _nmalloc_thr_init() to solve the problem.

* This also solves certain application crashes (mail/milter-greylist).

Reported-by: Francois Tigeot <ftigeot@wolfpond.org>
lib/libc/stdlib/nmalloc.c