summaryrefslogtreecommitdiff
path: root/pp_hot.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-09-22 12:06:45 -0700
committerFather Chrysostomos <sprout@cpan.org>2012-09-22 17:10:43 -0700
commit39984de3a8e9c16c0fee320a579cb465d0ce7314 (patch)
tree6de01c6f9ff381e7c3ade269ed1efbd1f685ab6e /pp_hot.c
parent9c744f4f4d7678009336db8141276918751b7c52 (diff)
downloadperl-39984de3a8e9c16c0fee320a579cb465d0ce7314.tar.gz
Stop array assignment from leaking on croak
This made a to-do test in sort.t pass, but adventitiously, so I modi- fied it to fail again.
Diffstat (limited to 'pp_hot.c')
-rw-r--r--pp_hot.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/pp_hot.c b/pp_hot.c
index 6057614f45..a8d762be5a 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -982,15 +982,14 @@ PP(pp_aassign)
while (relem <= lastrelem) { /* gobble up all the rest */
SV **didstore;
assert(*relem);
- sv = newSV(0);
+ sv = sv_newmortal();
sv_setsv(sv, *relem);
*(relem++) = sv;
didstore = av_store(ary,i++,sv);
+ if (didstore) SvREFCNT_inc_simple_void_NN(sv);
if (magic) {
if (SvSMAGICAL(sv))
mg_set(sv);
- if (!didstore)
- sv_2mortal(sv);
}
TAINT_NOT;
}