From: Father Chrysostomos Date: Sun, 28 Oct 2012 21:41:55 +0000 (-0700) Subject: regcomp.c: Stop regexp-to-pv assignemnt from leaking X-Git-Tag: upstream/5.20.0~5000 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=edd9fea2b8b49b8bfc982ef54ba4182316112678;p=platform%2Fupstream%2Fperl.git regcomp.c: Stop regexp-to-pv assignemnt from leaking SvPV_set will just set SvPVX, allowing the existing value to leak. This leak was caused by f082678508, which allowed reg_temp_copy to be called with an existing SV, but without modifying the contents of reg_temp_copy to account. --- diff --git a/regcomp.c b/regcomp.c index f676645..d524a99 100644 --- a/regcomp.c +++ b/regcomp.c @@ -14188,6 +14188,7 @@ Perl_reg_temp_copy (pTHX_ REGEXP *ret_x, REGEXP *rx) by pointing directly at the buffer, but flagging that the allocated space in the copy is zero. As we've just done a struct copy, it's now a case of zero-ing that, rather than copying the current length. */ + if (SvPOKp(ret_x)) SvPV_free(ret_x); SvPV_set(ret_x, RX_WRAPPED(rx)); SvFLAGS(ret_x) |= SvFLAGS(rx) & (SVf_POK|SVp_POK|SVf_UTF8); memcpy(&(ret->xpv_cur), &(r->xpv_cur),