This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Respect SvLEN==0 and SvOOK in sv.c:sv_sethek
[perl5.git] / sv.c
diff --git a/sv.c b/sv.c
index c28ed7d..283178f 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -4718,7 +4718,7 @@ Perl_sv_sethek(pTHX_ SV *const sv, const HEK *const hek)
         {
            SV_CHECK_THINKFIRST_COW_DROP(sv);
            SvUPGRADE(sv, SVt_PV);
-           Safefree(SvPVX(sv));
+           SvPV_free(sv);
            SvPV_set(sv,(char *)HEK_KEY(share_hek_hek(hek)));
            SvCUR_set(sv, HEK_LEN(hek));
            SvLEN_set(sv, 0);