diff options
author | k0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-11-02 11:40:43 +0000 |
---|---|---|
committer | k0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-11-02 11:40:43 +0000 |
commit | 6e9703b0116d5e1412f2ec80d81669acb49cb4c8 (patch) | |
tree | c6f06268837e81b3a8e2edb8e5a95471cff5f76a /mjit_worker.c | |
parent | 5de7b3b4f27df747899c243adbb10c9799ad1399 (diff) | |
download | ruby-6e9703b0116d5e1412f2ec80d81669acb49cb4c8.tar.gz |
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
Diffstat (limited to 'mjit_worker.c')
-rw-r--r-- | mjit_worker.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/mjit_worker.c b/mjit_worker.c index 0a6c8dc268..c8a7c212eb 100644 --- a/mjit_worker.c +++ b/mjit_worker.c @@ -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; } |