Skip to content

Commit

Permalink
Fix wrong allocation failure handling
Browse files Browse the repository at this point in the history
`iseq->body->jit_unit->compile_info` should not be referenced before
the null check of `iseq->body->jit_unit`.
  • Loading branch information
k0kubun committed Sep 20, 2019
1 parent 6e0dd3e commit 9e171b1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mjit.c
Expand Up @@ -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);
Expand Down

0 comments on commit 9e171b1

Please sign in to comment.