diff options
author | Father Chrysostomos <sprout@cpan.org> | 2011-05-30 08:55:40 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2011-05-30 08:55:40 -0700 |
commit | d34a666494db40538f88613ec991214f3a862865 (patch) | |
tree | c242f811519256c87fa3d2d11e0a852eedf657bd /time64.h | |
parent | b2b7346bfc59caff514d997701e0e086b983c863 (diff) | |
download | perl-d34a666494db40538f88613ec991214f3a862865.tar.gz |
[perl #91880] $_ refcounting problems in @INC filters
In @INC filters (subs returned by subs in @INC), $_ is localised to a
variable to which the next line of source code is to be assigned. The
function in pp_ctl.c that calls it (S_run_user_filter) has a pointer
to that variable.
Up till now, it was not setting the refcount or localising
$_ properly.
‘undef *_’ inside the sub would destroy the only refcount it
had, leaving a freed sv for toke.c to parse (which would crash,
of course).
In some cases, S_run_user_filter has to created a new variable. In
those cases, it was setting $_ to a mortal variable with the TEMP
flag, but with a refcount of 1, which would result in ‘Attempt to free
unreferenced scalar’ warnings if the $_ were freed by the subroutine.
This commit changes S_run_user_filter to use SAVEGENERICSV, rather
than SAVE_DEFSV, to localise $_, since the former lowers the refcount
on scope exit, while the latter does not. So now I have also made it
increase the refcount after assigning to the now-properly-localised $_
(DEFSV). I also turned off the TEMP flag, to avoid weird side effects
(which were what led me to this bug to begin with).
Diffstat (limited to 'time64.h')
0 files changed, 0 insertions, 0 deletions