This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Don’t leak when partly iterated glob op is freed
authorFather Chrysostomos <sprout@cpan.org>
Sun, 9 Dec 2012 14:05:22 +0000 (06:05 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Mon, 10 Dec 2012 02:47:21 +0000 (18:47 -0800)
commit11ddfebc6e521f916fd05108e3faa74e7ed132b8
tree6b2b9261790150d860d432183c3570ce76ca5ae3
parent6e2f1cd4c88b28bee7c3d0d21ce95d5b9fc4f991
Don’t leak when partly iterated glob op is freed

File::Glob keeps its own hash of arrays of file names.  Each array corresponds to one call site.  When iteration finishes, it deletes
the array.  But if iteration never finishes, and the op at the call
site is freed, the array remains.  So eval "scalar<*>" will cause a
memory leak.

We already have a mechanism for hooking the freeing of ops.  So
File::Glob can use that.
ext/File-Glob/Glob.xs
t/op/svleak.t