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

mjit_worker.c: do no access pointer after free

When we return there, `unit` is already freed.
This is detected by coverity scan.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65496 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
k0kubun 2018-11-02 11:40:43 +00:00
parent 5de7b3b4f2
commit 6e9703b011

View file

@ -1045,12 +1045,13 @@ convert_unit_to_func(struct rb_mjit_unit *unit, struct rb_call_cache *cc_entries
if (!mjit_opts.save_temps)
remove_file(c_file);
free_unit(unit);
in_jit = FALSE; /* just being explicit for return */
}
else {
in_jit = TRUE;
}
CRITICAL_SECTION_FINISH(3, "before mjit_compile to wait GC finish");
if (unit->iseq == NULL) {
if (!in_jit) {
return (mjit_func_t)NOT_COMPILED_JIT_ISEQ_FUNC;
}