diff options
author | Yusuke Endoh <mame@ruby-lang.org> | 2021-09-06 14:22:24 +0900 |
---|---|---|
committer | Yusuke Endoh <mame@ruby-lang.org> | 2021-09-06 14:22:24 +0900 |
commit | f336a3eb6c76890f3d8f878725b3d328c8fdcf33 (patch) | |
tree | d1478fa271a2e6713be94609fda1bfab644a43cc /signal.c | |
parent | 13dd07e3972fb41c8c834a46e29d34976f478fbc (diff) |
Use free instead of xfree to free altstack
The altstack memory of a thread may be free'ed even after the VM is
destructed. After that, GC is no longer available, so calling xfree
may lead to a segfault.
This changeset uses the bare free function to free the altstack memory
instead of xfree. [Bug #18126]
Diffstat (limited to 'signal.c')
-rw-r--r-- | signal.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -557,10 +557,13 @@ static int rb_sigaltstack_size_value = 0; void * rb_allocate_sigaltstack(void) { + void *altstack; if (!rb_sigaltstack_size_value) { rb_sigaltstack_size_value = rb_sigaltstack_size(); } - return xmalloc(rb_sigaltstack_size_value); + altstack = malloc(rb_sigaltstack_size_value); + if (!altstack) rb_memerror(); + return altstack; } /* alternate stack for SIGSEGV */ |