This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Don’t free initial src from @INC sub too early
authorFather Chrysostomos <sprout@cpan.org>
Fri, 20 Sep 2013 05:33:54 +0000 (22:33 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Fri, 20 Sep 2013 06:29:49 +0000 (23:29 -0700)
commitc39fcc0940e2ac63124db023cec87979daf4fa50
tree4357901460aebc262509aba93a4282f50b3f476f
parent85cf2eeaf59c1ded2a74e6c51fc7fc6ccd5d4efe
Don’t free initial src from @INC sub too early

As noted in <20130919225357.GA18474@mars.tony.develop-help.com>, com-
mit 839a0e5 introduces uninitialized warnings (and sometimes other
warnings) in inccode.t.

What actually is happening is that \PVBM is no longer being inlined
and returning the same reference each time, but is returning a new
mortal reference.  Commit 839a0e5 uncovers an existing bug.

A sub in @INC can return a reference to a scalar containing initial
source code.  That returned value would be freed prematurely if it was
not referenced elsewhere.

We have to increment its reference count before leaving the scope, and
then mortalise it afterwards.
pp_ctl.c
t/op/inccode.t