diff options
Diffstat (limited to 'op.c')
-rw-r--r-- | op.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -3796,6 +3796,8 @@ Perl_newLOOPEX(pTHX_ I32 type, OP *label) return o; } +static void const_sv_xsub(pTHX_ CV* cv); + /* =for apidoc cv_undef @@ -3811,8 +3813,9 @@ void Perl_cv_undef(pTHX_ CV *cv) { #ifdef USE_ITHREADS - if (CvFILE(cv) && !CvXSUB(cv)) { - /* for XSUBs CvFILE point directly to static memory; __FILE__ */ + if (CvFILE(cv) && (!CvXSUB(cv) || CvXSUB(cv) == const_sv_xsub)) { + /* for XSUBs CvFILE point directly to static memory; __FILE__ + * except when XSUB was constructed via newCONSTSUB() */ Safefree(CvFILE(cv)); } CvFILE(cv) = 0; @@ -3874,8 +3877,6 @@ Perl_cv_ckproto(pTHX_ CV *cv, GV *gv, char *p) } } -static void const_sv_xsub(pTHX_ CV* cv); - /* =head1 Optree Manipulation Functions @@ -4359,6 +4360,9 @@ Perl_newCONSTSUB(pTHX_ HV *stash, char *name, SV *sv) CvCONST_on(cv); sv_setpv((SV*)cv, ""); /* prototype is "" */ + if (stash) + CopSTASH_free(PL_curcop); + LEAVE; return cv; |