From owner-perl5-porters@nicoh.com Tue Mar 14 01:04:05 1995 Return-Path: Message-Id: <9503140043.AA25781@scalpel> To: perl5@scalpel.netlabs.com Subject: s/// memory leak in 5.001 Date: Mon, 13 Mar 95 16:43:53 -0800 From: lwall@scalpel.netlabs.com (Larry Wall) Sender: owner-perl5-porters@nicoh.com List-Name: perl5-porters Precedence: bulk P-From: Larry Wall In fixing another bug I installed a nasty memory leak in s///. Here's the fix. Larry *** pp_hot.c Mon Mar 6 20:55:34 1995 --- work/pp_hot.c Mon Mar 13 16:21:54 1995 *************** *** 1451,1456 **** --- 1451,1457 ---- safebase)); sv_catpvn(dstr, s, strend - s); + Safefree(SvPVX(TARG)); SvPVX(TARG) = SvPVX(dstr); SvCUR_set(TARG, SvCUR(dstr)); SvLEN_set(TARG, SvLEN(dstr)); *** pp_ctl.c Mon Mar 6 20:42:19 1995 --- work/pp_ctl.c Mon Mar 13 16:22:12 1995 *************** *** 114,119 **** --- 114,120 ---- SV *targ = cx->sb_targ; sv_catpvn(dstr, s, cx->sb_strend - s); + Safefree(SvPVX(targ)); SvPVX(targ) = SvPVX(dstr); SvCUR_set(targ, SvCUR(dstr)); SvLEN_set(targ, SvLEN(dstr));