diff options
| author | dearblue <[email protected]> | 2021-01-10 21:41:51 +0900 |
|---|---|---|
| committer | dearblue <[email protected]> | 2021-01-10 21:41:51 +0900 |
| commit | 3fc848b54575b1f9ed60106365bc2223c109e2a1 (patch) | |
| tree | 767a63663d60feeeda99ffc42c88941ae826c98f /src/proc.c | |
| parent | e8e28eacc72f4648ca1bd75f4d6d7ea51b76df3f (diff) | |
| download | mruby-3fc848b54575b1f9ed60106365bc2223c109e2a1.tar.gz mruby-3fc848b54575b1f9ed60106365bc2223c109e2a1.zip | |
Replace `tempirep` with `RProc`
Previously I used the `RData` object to avoid a memory leak in `mrb_irep` if `src/load.c` failed.
ref: https://github.com/mruby/mruby/pull/4250
commit: f1523d24042ca3416dc5b9be7b3fc220ddaed896
Considering that the `RProc` object will be created in the subsequent process, it is preferable to create the `RProc` object from the beginning.
Along with this, the inside of `read_irep()` is replaced with the processing centered on the `RProc` object.
The global function that returns the `mrb_irep` pointer is still provided for compatibility.
Diffstat (limited to 'src/proc.c')
| -rw-r--r-- | src/proc.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/proc.c b/src/proc.c index d58d9d0df..68ca941c3 100644 --- a/src/proc.c +++ b/src/proc.c @@ -52,7 +52,9 @@ mrb_proc_new(mrb_state *mrb, const mrb_irep *irep) p->e.target_class = tc; } p->body.irep = irep; - mrb_irep_incref(mrb, (mrb_irep*)irep); + if (irep) { + mrb_irep_incref(mrb, (mrb_irep*)irep); + } return p; } |
