--- sv.c.orig 2011-05-08 05:10:08.000000000 +0200 +++ sv.c 2011-06-06 16:12:07.421329360 +0200 @@ -6638,6 +6638,18 @@ Perl_sv_clear(pTHX_ SV *const orig_sv) assert(SvREFCNT(sv) == 0); assert(!SvIS_FREED(sv)); + + if (type == SVTYPEMASK) { + /* in some bad cases, scalar is freed a second time, + resulting in a segfault (mdvbz#34505) in mg_free(sv) below. + + perl HEAD has an assert (http://public.activestate.com/cgi-bin/perlbrowse/p/32788), + but since we can't reproduce and it's seems hard to fix those cases, + (as http://rt.perl.org/rt3/Public/Bug/Display.html?id=50142 seems to say ??) + we need to workaround... */ + return; + } + #if NVSIZE <= IVSIZE if (type <= SVt_NV) { #else