Continue hunting for the cause of the Tru64 failed threaded smokes
Jarkko Hietaniemi [Sun, 13 Apr 2003 09:32:05 +0000 (09:32 +0000)]
most probably introduced by the change #19157.  The tweak suggested
by Stephen McCamant trades a possible dangling pointer (CopFILE()
is tricky like that with threads) to a memory leak.  (This means
that this tweak shouldn't be left in as-is, but if this helps,
we at least know that the failure was caused by the #19157.)
p4raw-link: @19157 on //depot/perl: 3871c2ef9aa1dfeba4631a17efdbf486012d47a6

p4raw-id: //depot/perl@19197

op.c

diff --git a/op.c b/op.c
index 5ccb73d..1ac2703 100644 (file)
--- a/op.c
+++ b/op.c
@@ -4273,7 +4273,7 @@ Perl_newCONSTSUB(pTHX_ HV *stash, char *name, SV *sv)
        CopSTASH_set(PL_curcop,stash);
     }
 
-    cv = newXS(name, const_sv_xsub, CopFILE(PL_curcop));
+    cv = newXS(name, const_sv_xsub, savepv(CopFILE(PL_curcop)));
     CvXSUBANY(cv).any_ptr = sv;
     CvCONST_on(cv);
     sv_setpv((SV*)cv, "");  /* prototype is "" */