This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
fix another CvMUTEXP() leak
[perl5.git] / gv.c
diff --git a/gv.c b/gv.c
index 505f633..4adce49 100644 (file)
--- a/gv.c
+++ b/gv.c
@@ -124,7 +124,8 @@ gv_init(GV *gv, HV *stash, char *name, STRLEN len, int multi)
        CvSTASH(GvCV(gv)) = curstash;
 #ifdef USE_THREADS
        CvOWNER(GvCV(gv)) = 0;
-       New(666, CvMUTEXP(GvCV(gv)), 1, perl_mutex);
+       if (!CvMUTEXP(GvCV(gv)))
+           New(666, CvMUTEXP(GvCV(gv)), 1, perl_mutex);
        MUTEX_INIT(CvMUTEXP(GvCV(gv)));
 #endif /* USE_THREADS */
        if (proto) {