summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2009-05-19 09:15:46 +0100
committerNicholas Clark <nick@ccl4.org>2009-05-19 09:15:46 +0100
commite92c6be8349ad1d36d6df1dcb526fd37421e9970 (patch)
treedff7dc23e6c6fe82b382714d2327a90643b930d0
parentc87a7fa90205d44374da5df59a2566caf6e06bfb (diff)
downloadperl-e92c6be8349ad1d36d6df1dcb526fd37421e9970.tar.gz
In perl_clone_using(), use sv_dup_inc_multiple() to clone the temps stack.
Avoid using Newxz() to zero allocate memory we will immediately overwrite.
-rw-r--r--sv.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/sv.c b/sv.c
index c7468ecd80..6e7fbd40a0 100644
--- a/sv.c
+++ b/sv.c
@@ -12205,12 +12205,9 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags,
PL_tmps_ix = proto_perl->Itmps_ix;
PL_tmps_max = proto_perl->Itmps_max;
PL_tmps_floor = proto_perl->Itmps_floor;
- Newxz(PL_tmps_stack, PL_tmps_max, SV*);
- i = 0;
- while (i <= PL_tmps_ix) {
- PL_tmps_stack[i] = sv_dup_inc(proto_perl->Itmps_stack[i], param);
- ++i;
- }
+ Newx(PL_tmps_stack, PL_tmps_max, SV*);
+ sv_dup_inc_multiple(proto_perl->Itmps_stack, PL_tmps_stack, PL_tmps_ix,
+ param);
/* next PUSHMARK() sets *(PL_markstack_ptr+1) */
i = proto_perl->Imarkstack_max - proto_perl->Imarkstack;