зеркало из https://github.com/github/ruby.git
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]
This commit is contained in:
Родитель
13dd07e397
Коммит
f336a3eb6c
5
signal.c
5
signal.c
|
@ -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 */
|
||||
|
|
|
@ -136,7 +136,7 @@
|
|||
void *rb_allocate_sigaltstack(void);
|
||||
void *rb_register_sigaltstack(void *);
|
||||
# define RB_ALTSTACK_INIT(var, altstack) var = rb_register_sigaltstack(altstack)
|
||||
# define RB_ALTSTACK_FREE(var) xfree(var)
|
||||
# define RB_ALTSTACK_FREE(var) free(var)
|
||||
# define RB_ALTSTACK(var) var
|
||||
#else /* noop */
|
||||
# define RB_ALTSTACK_INIT(var, altstack)
|
||||
|
|
Загрузка…
Ссылка в новой задаче