From: Adrian M. Enache Date: Mon, 20 Jan 2003 01:54:07 +0000 (+0000) Subject: [perl #20408] SV's SvPVX get freed even when its SvLEN is zero X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2c28e92fc113ea28fd1822b2d63d3c1bfedbac8f;p=p5sagit%2Fp5-mst-13.2.git [perl #20408] SV's SvPVX get freed even when its SvLEN is zero From: "enache@rdslink.ro (via RT)" Message-Id: p4raw-id: //depot/perl@18522 --- diff --git a/pp_hot.c b/pp_hot.c index 461c666..1a40441 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));