summaryrefslogtreecommitdiff
path: root/av.c
diff options
context:
space:
mode:
authorDave Mitchell <davem@fdisolutions.com>2004-03-31 20:33:52 +0000
committerDave Mitchell <davem@fdisolutions.com>2004-03-31 20:33:52 +0000
commita62140726edcf5b33bdd8fed9a26ab90d77ec144 (patch)
tree8e73b0fa645f1e1832f44a05af435779b7f50c73 /av.c
parent7be0dac30b98062294521bd59732f1029a6de1ce (diff)
downloadperl-a62140726edcf5b33bdd8fed9a26ab90d77ec144.tar.gz
[perl #28032] delete $_[0] + (\$) prototype = bad free
av_delete() didn't reify. I also updated its description p4raw-id: //depot/perl@22624
Diffstat (limited to 'av.c')
-rw-r--r--av.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/av.c b/av.c
index ac623cc2de..9cae02393a 100644
--- a/av.c
+++ b/av.c
@@ -782,7 +782,8 @@ Perl_av_fill(pTHX_ register AV *av, I32 fill)
=for apidoc av_delete
Deletes the element indexed by C<key> from the array. Returns the
-deleted element. C<flags> is currently ignored.
+deleted element. If C<flags> equals C<G_DISCARD>, the element is freed
+and null is returned.
=cut
*/
@@ -840,6 +841,8 @@ Perl_av_delete(pTHX_ AV *av, I32 key, I32 flags)
if (key > AvFILLp(av))
return Nullsv;
else {
+ if (!AvREAL(av) && AvREIFY(av))
+ av_reify(av);
sv = AvARRAY(av)[key];
if (key == AvFILLp(av)) {
AvARRAY(av)[key] = &PL_sv_undef;