summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--av.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/av.c b/av.c
index c7ca844165..9e94805f68 100644
--- a/av.c
+++ b/av.c
@@ -33,6 +33,9 @@ AV* av;
if (sv != &sv_undef)
(void)SvREFCNT_inc(sv);
}
+ key = AvARRAY(av) - AvALLOC(av);
+ while (key)
+ AvALLOC(av)[--key] = &sv_undef;
AvREAL_on(av);
}
@@ -197,10 +200,10 @@ SV *val;
}
if (SvREADONLY(av) && key >= AvFILL(av))
croak(no_modify);
- if (key > AvMAX(av))
- av_extend(av,key);
if (!AvREAL(av) && AvREIFY(av))
av_reify(av);
+ if (key > AvMAX(av))
+ av_extend(av,key);
ary = AvARRAY(av);
if (AvFILL(av) < key) {
if (!AvREAL(av)) {