summaryrefslogtreecommitdiff
path: root/gv.c
diff options
context:
space:
mode:
Diffstat (limited to 'gv.c')
-rw-r--r--gv.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gv.c b/gv.c
index 90fb13a386..1f1ee0608e 100644
--- a/gv.c
+++ b/gv.c
@@ -376,7 +376,10 @@ Perl_gv_init_pvn(pTHX_ GV *gv, HV *stash, const char *name, STRLEN len, U32 flag
name0 = savepvn(name,len);
/* newCONSTSUB takes ownership of the reference from us. */
- cv = newCONSTSUB_flags(stash, (name0 ? name0 : name), flags, has_constant);
+ cv = newCONSTSUB_flags(
+ stash, (name0 ? name0 : name),
+ strlen(name0 ? name0 : name), flags, has_constant
+ );
/* In case op.c:S_process_special_blocks stole it: */
if (!GvCV(gv))
GvCV_set(gv, (CV *)SvREFCNT_inc_simple_NN(cv));