Branch: refs/heads/master
Home: https://github.com/perl5-dbi/dbi
Commit: b34f9c564a3a12e3530ba1c6864aa13cff94b62c
https://github.com/perl5-dbi/dbi/commit/b34f9c564a3a12e3530ba1c6864aa13cff94b62c
Author: Lukas Mai <[email protected]>
Date: 2024-08-10 (Sat, 10 Aug 2024)
Changed paths:
M DBI.xs
M t/70callbacks.t
Log Message:
-----------
don't leak $_ after callback execution
The code responsible for executing callbacks (as in the $h->{Callbacks}
feature) saves a copy of *_{SCALAR} (that is, the scalar slot of the *_
typeglob), replaces it with a reference to a temporary scalar
(containing the name of the method being called), invokes the callback,
and then restores the old *_{SCALAR}. This works like manually
localizing (and then unlocalizing) $_.
However, before restoring the old $_, the code would increment its
reference count "to compensate for the ref count decrement that will
happen when we exit the scope". As far as I can tell, this never made
any sense: $_ is a global variable and we never decrement its reference
count. All this did is increment the reference count of $_ for no
reason. This was usually harmless: $_ is a global variable anyway. But
if $_ is localized (explicitly or by 'for (...)') when a callback runs,
the local value of $_ would leak.
Fix the leak by removing the spurious SvREFCNT_inc.
Fixes RT#144526.
Commit: dd18656a39e44a39df8b8b492ab58fd1ca0ee974
https://github.com/perl5-dbi/dbi/commit/dd18656a39e44a39df8b8b492ab58fd1ca0ee974
Author: H.Merijn Brand <[email protected]>
Date: 2024-08-11 (Sun, 11 Aug 2024)
Changed paths:
M DBI.xs
M t/70callbacks.t
Log Message:
-----------
Merge pull request #117 from mauke/fix-callback-leak-rt-144526
don't leak $_ after callback execution
Compare: https://github.com/perl5-dbi/dbi/compare/bcbf1cc5bc38...dd18656a39e4
To unsubscribe from these emails, change your notification settings at
https://github.com/perl5-dbi/dbi/settings/notifications