1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Fix wrong allocation failure handling

`iseq->body->jit_unit->compile_info` should not be referenced before
the null check of `iseq->body->jit_unit`.
This commit is contained in:
Takashi Kokubun 2019-09-20 21:50:00 +09:00
parent 6e0dd3e7c1
commit 9e171b1fa0
No known key found for this signature in database
GPG key ID: 6FFC433B12EE23DD

4
mjit.c
View file

@ -368,11 +368,11 @@ mjit_add_iseq_to_process(const rb_iseq_t *iseq, const struct rb_mjit_compile_inf
iseq->body->jit_func = (mjit_func_t)NOT_READY_JIT_ISEQ_FUNC;
create_unit(iseq);
if (compile_info != NULL)
iseq->body->jit_unit->compile_info = *compile_info;
if (iseq->body->jit_unit == NULL)
// Failure in creating the unit.
return;
if (compile_info != NULL)
iseq->body->jit_unit->compile_info = *compile_info;
CRITICAL_SECTION_START(3, "in add_iseq_to_process");
add_to_list(iseq->body->jit_unit, &unit_queue);