Adrian M. Enache [Thu, 11 Dec 2003 23:04:03 +0000 (23:04 +0000)]
p4raw-id: //depot/perl@21876
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);
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);