This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #93454] Free deleted iterator when freeing hash
authorFather Chrysostomos <sprout@cpan.org>
Fri, 24 Jun 2011 15:17:28 +0000 (08:17 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Fri, 24 Jun 2011 15:19:28 +0000 (08:19 -0700)
commit6d1c68e64c4dbbb1c7e8a28de678cd3247649bad
tree429f168000f8db2ec45dd6e3ff555fb90e465f08
parentf4e68e82b126f2b2bfde4c660b1045c1e4a69455
[perl #93454] Free deleted iterator when freeing hash

Commit 7d6175e, which did a fix-up after commit e0171a1a3, which
introduced hfree_next_entry, did not account for the fact that
hfree_next_entry frees the hash iterator before removing and returning
the next value.

It changed the callers to check the number of keys to determine
whether anything else needed to be freed, which meant that
hfree_next_entry was called one time less than necessary on hashes
whose current iterator had been deleted and which consequently
appeared empty.

This fixes that.

I don’t know how to test it, but the string table warnings were caus-
ing test failures on VMS, so maybe that’s good enough.
hv.c
sv.c