summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pp_hot.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/pp_hot.c b/pp_hot.c
index 461c666ac9..1a40441ad8 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -2129,7 +2129,8 @@ PP(pp_subst)
sv_catpvn(dstr, s, strend - s);
(void)SvOOK_off(TARG);
- Safefree(SvPVX(TARG));
+ if (SvLEN(TARG))
+ Safefree(SvPVX(TARG));
SvPVX(TARG) = SvPVX(dstr);
SvCUR_set(TARG, SvCUR(dstr));
SvLEN_set(TARG, SvLEN(dstr));