diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2017-06-23 11:18:16 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2017-06-23 11:18:16 +0300 |
commit | 3b16a75d1db40a052123b0cdce7d4bb17a5e32d6 (patch) | |
tree | da2ab9d267453e47877199d249ef76af666eaa8f /thread_local_alloc.c | |
parent | dc488239f1b4b3e7c4322736aab4fe4f0139abb4 (diff) | |
download | bdwgc-3b16a75d1db40a052123b0cdce7d4bb17a5e32d6.tar.gz |
Check thread_local is initialized before accessing thread_key
* thread_local_alloc.c [GC_GCJ_SUPPORT] (GC_gcj_malloc): Move
GC_ASSERT(GC_gcj_malloc_initialized) to be before accessing
GC_thread_key.
Diffstat (limited to 'thread_local_alloc.c')
-rw-r--r-- | thread_local_alloc.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/thread_local_alloc.c b/thread_local_alloc.c index 4aae5c9f..0919935d 100644 --- a/thread_local_alloc.c +++ b/thread_local_alloc.c @@ -227,9 +227,10 @@ GC_API GC_ATTR_MALLOC void * GC_CALL GC_gcj_malloc(size_t bytes, } else { size_t granules = ROUNDED_UP_GRANULES(bytes); void *result; - void **tiny_fl = ((GC_tlfs)GC_getspecific(GC_thread_key)) - -> gcj_freelists; + void **tiny_fl; + GC_ASSERT(GC_gcj_malloc_initialized); + tiny_fl = ((GC_tlfs)GC_getspecific(GC_thread_key))->gcj_freelists; GC_FAST_MALLOC_GRANS(result, granules, tiny_fl, DIRECT_GRANULES, GC_gcj_kind, GC_core_gcj_malloc(bytes, |