From: Adrian M. Enache Date: Thu, 11 Dec 2003 23:04:03 +0000 (+0000) Subject: #21866 was wrong. another try to plumb that damn leak. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=979acdb57942c7eba962592584b8668e204b0c71;p=p5sagit%2Fp5-mst-13.2.git #21866 was wrong. another try to plumb that damn leak. p4raw-id: //depot/perl@21876 --- diff --git a/mg.c b/mg.c index 7955e52..4ef7910 100644 --- a/mg.c +++ b/mg.c @@ -384,7 +384,7 @@ Perl_mg_free(pTHX_ SV *sv) if (vtbl && vtbl->svt_free) CALL_FPTR(vtbl->svt_free)(aTHX_ sv, mg); if (mg->mg_ptr && mg->mg_type != PERL_MAGIC_regex_global) { - if (mg->mg_len > 0) + if (mg->mg_len > 0 || mg->mg_type == PERL_MAGIC_utf8) Safefree(mg->mg_ptr); else if (mg->mg_len == HEf_SVKEY) SvREFCNT_dec((SV*)mg->mg_ptr); diff --git a/sv.c b/sv.c index 40d99cb..47616ce 100644 --- a/sv.c +++ b/sv.c @@ -6060,8 +6060,7 @@ Perl_sv_pos_b2u(pTHX_ register SV* sv, I32* offsetp) assert(mg); if (!mg->mg_ptr) { - mg->mg_len = PERL_MAGIC_UTF8_CACHESIZE * 2; - Newz(0, cache, mg->mg_len, STRLEN); + Newz(0, cache, PERL_MAGIC_UTF8_CACHESIZE * 2, STRLEN); mg->mg_ptr = (char *) cache; } assert(cache);