summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/sv.c b/sv.c
index d8d0ff8add..a2d0cbc204 100644
--- a/sv.c
+++ b/sv.c
@@ -3741,7 +3741,7 @@ static void
S_glob_assign_ref(pTHX_ SV *const dstr, SV *const sstr)
{
SV * const sref = SvRV(sstr);
- SV *dref = NULL;
+ SV *dref;
const int intro = GvINTRO(dstr);
SV **location;
U8 import_flag = 0;
@@ -3789,8 +3789,7 @@ S_glob_assign_ref(pTHX_ SV *const dstr, SV *const sstr)
}
SAVEGENERICSV(*location);
}
- else
- dref = *location;
+ dref = *location;
if (stype == SVt_PVCV && (*location != sref || GvCVGEN(dstr))) {
CV* const cv = MUTABLE_CV(*location);
if (cv) {
@@ -3907,7 +3906,7 @@ S_glob_assign_ref(pTHX_ SV *const dstr, SV *const sstr)
}
break;
}
- SvREFCNT_dec(dref);
+ if (!intro) SvREFCNT_dec(dref);
if (SvTAINTED(sstr))
SvTAINT(dstr);
return;