mg_free frees data but leaves it accessible
Yuval Kogman [Fri, 21 Dec 2007 00:13:31 +0000 (02:13 +0200)]
Message-ID: <20071220221331.GG10631@woobling.org>
Date: Fri, 21 Dec 2007 00:13:31 +0200

p4raw-id: //depot/perl@32686

mg.c

diff --git a/mg.c b/mg.c
index 4a6c689..f341f23 100644 (file)
--- a/mg.c
+++ b/mg.c
@@ -497,6 +497,7 @@ Perl_mg_free(pTHX_ SV *sv)
        if (mg->mg_flags & MGf_REFCOUNTED)
            SvREFCNT_dec(mg->mg_obj);
        Safefree(mg);
+       SvMAGIC_set(sv, moremagic);
     }
     SvMAGIC_set(sv, NULL);
     return 0;