This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
fix CvMUTEXP() leaks with -Dusethreads
authorGurusamy Sarathy <gsar@cpan.org>
Sat, 18 Jul 1998 01:22:35 +0000 (01:22 +0000)
committerGurusamy Sarathy <gsar@cpan.org>
Sat, 18 Jul 1998 01:22:35 +0000 (01:22 +0000)
p4raw-id: //depot/perl@1524

op.c
toke.c

diff --git a/op.c b/op.c
index ecefb83..a123b58 100644 (file)
--- a/op.c
+++ b/op.c
@@ -3532,7 +3532,8 @@ newSUB(I32 floor, OP *o, OP *proto, OP *block)
     CvSTASH(cv) = curstash;
 #ifdef USE_THREADS
     CvOWNER(cv) = 0;
-    New(666, CvMUTEXP(cv), 1, perl_mutex);
+    if (!CvMUTEXP(cv))
+       New(666, CvMUTEXP(cv), 1, perl_mutex);
     MUTEX_INIT(CvMUTEXP(cv));
 #endif /* USE_THREADS */
 
diff --git a/toke.c b/toke.c
index db87758..9685fc3 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -5967,9 +5967,6 @@ start_subparse(I32 is_format, U32 flags)
     av_store(comppad_name, 0, newSVpv("@_", 2));
     curpad[0] = (SV*)newAV();
     SvPADMY_on(curpad[0]);     /* XXX Needed? */
-    CvOWNER(compcv) = 0;
-    New(666, CvMUTEXP(compcv), 1, perl_mutex);
-    MUTEX_INIT(CvMUTEXP(compcv));
 #endif /* USE_THREADS */
 
     comppadlist = newAV();