aboutsummaryrefslogtreecommitdiffstats
path: root/mjit.c
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2019-09-20 21:50:00 +0900
committerTakashi Kokubun <takashikkbn@gmail.com>2019-09-20 21:50:33 +0900
commit9e171b1fa0b4e2e5b0bf82da11b4b511c602c336 (patch)
treefa02c22a99577518dd0be7d8a39523a62bb697d5 /mjit.c
parent6e0dd3e7c1786e33c3193d0b4dd9579655c4e842 (diff)
downloadruby-9e171b1fa0b4e2e5b0bf82da11b4b511c602c336.tar.gz
Fix wrong allocation failure handling
`iseq->body->jit_unit->compile_info` should not be referenced before the null check of `iseq->body->jit_unit`.
Diffstat (limited to 'mjit.c')
-rw-r--r--mjit.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/mjit.c b/mjit.c
index 26a2a4eb1a..3ae9410179 100644
--- a/mjit.c
+++ b/mjit.c
@@ -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);