summaryrefslogtreecommitdiff
path: root/malloc.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2016-11-19 20:37:04 +0300
committerIvan Maidanski <ivmai@mail.ru>2016-11-19 20:37:04 +0300
commit0cceec20a3d5f665d36dd30551eca460b2fd8ebe (patch)
treee2c85c0addbf24cf7fff7b45b50d5d7e025104a3 /malloc.c
parentf918c281d831a8565f6c589448981eae4bfe4a1b (diff)
downloadbdwgc-0cceec20a3d5f665d36dd30551eca460b2fd8ebe.tar.gz
Fix assertion violation in GC_repeat_read if --enable-redirect-malloc
* malloc.c [REDIRECT_MALLOC && GC_LINUX_THREADS] (GC_init_lib_bounds): Declare cancel_state local variable; DISABLE_CANCEL for GC_text_mapping (because GC_repeat_read expects the cancellation state off); call RESTORE_CANCEL on return.
Diffstat (limited to 'malloc.c')
-rw-r--r--malloc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/malloc.c b/malloc.c
index 5301518c..a6e0333e 100644
--- a/malloc.c
+++ b/malloc.c
@@ -411,7 +411,10 @@ GC_API GC_ATTR_MALLOC void * GC_CALL GC_malloc_uncollectable(size_t lb)
STATIC void GC_init_lib_bounds(void)
{
+ IF_CANCEL(int cancel_state;)
+
if (GC_libpthread_start != 0) return;
+ DISABLE_CANCEL(cancel_state);
GC_init(); /* if not called yet */
if (!GC_text_mapping("libpthread-",
&GC_libpthread_start, &GC_libpthread_end)) {
@@ -424,6 +427,7 @@ GC_API GC_ATTR_MALLOC void * GC_CALL GC_malloc_uncollectable(size_t lb)
if (!GC_text_mapping("ld-", &GC_libld_start, &GC_libld_end)) {
WARN("Failed to find ld.so text mapping: Expect crash\n", 0);
}
+ RESTORE_CANCEL(cancel_state);
}
# endif /* GC_LINUX_THREADS */