summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorTony Cook <tony@develop-help.com>2021-10-21 14:16:54 +1100
committerTony Cook <tony@develop-help.com>2021-11-15 11:35:42 +1100
commit9c913148860b0e83e6149d37e86cdb29663ee812 (patch)
tree7f710ef653664ac0a0bb48561554f5a45e8ca8ce /op.c
parent9bce496f83cb607054f21c015c5f377c24c86bfd (diff)
downloadperl-9c913148860b0e83e6149d37e86cdb29663ee812.tar.gz
Add CopFILEAVn() and use it when cleaning up COP pointers
On threaded builds CopFILEAV() calls gv_fetchfile(), which always created the *{"::_<filenamehere"} glob, so the attempted clean up here could recreate the glob, even if it has already been removed when cleaning up a string eval. To avoid this, add CopFILEAVn() that never creates the glob, nor the AV so that the clean up never adds new objects. This change makes the check for PL_phase unnecessary, but that check is much cheaper than the call for gv_fetchfile_flags() that the macro hides, so retain the check.
Diffstat (limited to 'op.c')
-rw-r--r--op.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/op.c b/op.c
index e1584cfde1..3c5079ab4d 100644
--- a/op.c
+++ b/op.c
@@ -1325,7 +1325,7 @@ S_cop_free(pTHX_ COP* cop)
This could cause a freed memory overwrite if the debugger tried to
set a breakpoint on this line.
*/
- AV *av = CopFILEAV(cop);
+ AV *av = CopFILEAVn(cop);
if (av) {
SV * const * const svp = av_fetch(av, CopLINE(cop), FALSE);
if (svp && *svp != &PL_sv_undef && SvIVX(*svp) == PTR2IV(cop) ) {