From: Nicholas Clark Date: Tue, 11 Apr 2006 16:17:13 +0000 (+0000) Subject: Stop Perl_newSVpvn_share() potentially leaking the return result from X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a51caccf222faf8588ed061240391957b9a0e70d;p=p5sagit%2Fp5-mst-13.2.git Stop Perl_newSVpvn_share() potentially leaking the return result from bytes_from_utf8(). p4raw-id: //depot/perl@27766 --- diff --git a/sv.c b/sv.c index de8f973..02e83a1 100644 --- a/sv.c +++ b/sv.c @@ -6990,6 +6990,8 @@ Perl_newSVpvn_share(pTHX_ const char *src, I32 len, U32 hash) dVAR; register SV *sv; bool is_utf8 = FALSE; + const char *const orig_src = src; + if (len < 0) { STRLEN tmplen = -len; is_utf8 = TRUE; @@ -7009,6 +7011,8 @@ Perl_newSVpvn_share(pTHX_ const char *src, I32 len, U32 hash) SvPOK_on(sv); if (is_utf8) SvUTF8_on(sv); + if (src != orig_src) + Safefree(src); return sv; }