From: Adrian M. Enache Date: Mon, 8 Dec 2003 03:30:16 +0000 (+0000) Subject: plumb a leak with pos(). X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=26ef79ca764308aafc052155f9b90d39f1d9c77a;p=p5sagit%2Fp5-mst-13.2.git plumb a leak with pos(). #! perl while (1) { my $a = "\x{1ff}"; $a =~ /\x{1ff}/g; pos($a); } __END__ p4raw-id: //depot/perl@21866 --- diff --git a/sv.c b/sv.c index dc089b8..6f53c58 100644 --- a/sv.c +++ b/sv.c @@ -6056,7 +6056,8 @@ Perl_sv_pos_b2u(pTHX_ register SV* sv, I32* offsetp) assert(mg); if (!mg->mg_ptr) { - Newz(0, cache, PERL_MAGIC_UTF8_CACHESIZE * 2, STRLEN); + mg->mg_len = PERL_MAGIC_UTF8_CACHESIZE * 2; + Newz(0, cache, mg->mg_len, STRLEN); mg->mg_ptr = (char *) cache; } assert(cache);