diff options
author | Tony Cook <tony@develop-help.com> | 2020-10-29 15:59:16 +1100 |
---|---|---|
committer | Tony Cook <tony@develop-help.com> | 2020-10-29 15:59:16 +1100 |
commit | fb072d007726c7ba114978a00f8f4f687ad7a55a (patch) | |
tree | 7900539979da1d88eca55303850d6f646de27d61 /mg.c | |
parent | dfee93524089fd4fa372ce7e0dd15e2809b5c540 (diff) | |
download | perl-fb072d007726c7ba114978a00f8f4f687ad7a55a.tar.gz |
remove assertion that collation magic has data
This broke on some smokers where the locale collation data was
broken in some way (and rejected by the collation setup code.)
It also broke if collation magic was generated for an SV and then
the SV was modified, freeing the collation data before the SV was
destroyed.
Diffstat (limited to 'mg.c')
-rw-r--r-- | mg.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -2669,9 +2669,12 @@ Perl_magic_freecollxfrm(pTHX_ SV *sv, MAGIC *mg) /* Collate magic uses mg_len as a string length rather than a buffer * length, so we need to free even with mg_len == 0: hence we can't * rely on standard magic free handling */ - assert(mg->mg_type == PERL_MAGIC_collxfrm && mg->mg_len >= 0); - Safefree(mg->mg_ptr); - mg->mg_ptr = NULL; + if (mg->mg_len >= 0) { + assert(mg->mg_type == PERL_MAGIC_collxfrm); + Safefree(mg->mg_ptr); + mg->mg_ptr = NULL; + } + return 0; } #endif /* USE_LOCALE_COLLATE */ |