summaryrefslogtreecommitdiff
path: root/pad.c
diff options
context:
space:
mode:
Diffstat (limited to 'pad.c')
-rw-r--r--pad.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/pad.c b/pad.c
index e8ba139434..92f4041398 100644
--- a/pad.c
+++ b/pad.c
@@ -1573,6 +1573,8 @@ Perl_cv_clone(pTHX_ CV *proto)
#endif
CvGV(cv) = CvGV(proto);
CvSTASH(cv) = CvSTASH(proto);
+ if (CvSTASH(cv))
+ Perl_sv_add_backref(aTHX_ MUTABLE_SV(CvSTASH(cv)), MUTABLE_SV(cv));
OP_REFCNT_LOCK;
CvROOT(cv) = OpREFCNT_inc(CvROOT(proto));
OP_REFCNT_UNLOCK;