diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-09-01 06:50:24 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-09-01 06:51:59 +0900 |
| commit | ab99e2c293167935033016750c010047a2aba76a (patch) | |
| tree | 56ea8a959823904f28192749500cd8159fd581e4 /src/proc.c | |
| parent | 57610091ced4163d577f813c7d32581be8ba1d9c (diff) | |
| download | mruby-ab99e2c293167935033016750c010047a2aba76a.tar.gz mruby-ab99e2c293167935033016750c010047a2aba76a.zip | |
Avoid copying over initialized procs using `initialize_copy`; fix #3803
It may be better to raise exceptions, but CRuby doesn't.
Diffstat (limited to 'src/proc.c')
| -rw-r--r-- | src/proc.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/proc.c b/src/proc.c index 96b080f9e..10a2c4f33 100644 --- a/src/proc.c +++ b/src/proc.c @@ -139,6 +139,10 @@ mrb_proc_cfunc_env_get(mrb_state *mrb, mrb_int idx) void mrb_proc_copy(struct RProc *a, struct RProc *b) { + if (a->body.irep) { + /* already initialized proc */ + return; + } a->flags = b->flags; a->body = b->body; if (!MRB_PROC_CFUNC_P(a) && a->body.irep) { |
