From: David Mitchell Date: Wed, 5 Aug 2009 14:23:41 +0000 (+0100) Subject: in perl_clone_using, free the prt_table X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b0b93b3c773176a99136baa97661d11503277415;p=p5sagit%2Fp5-mst-13.2.git in perl_clone_using, free the prt_table *after* we have called any CLONE methods (better fix for Variable::Magic than 240bfeb992) --- diff --git a/sv.c b/sv.c index 8bfe441..a22316c 100644 --- a/sv.c +++ b/sv.c @@ -12349,11 +12349,6 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags, PL_registered_mros = hv_dup_inc(proto_perl->Iregistered_mros, param); - if (!(flags & CLONEf_KEEP_PTR_TABLE)) { - ptr_table_free(PL_ptr_table); - PL_ptr_table = NULL; - } - /* Call the ->CLONE method, if it exists, for each of the stashes identified by sv_dup() above. */ @@ -12373,6 +12368,12 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags, } } + if (!(flags & CLONEf_KEEP_PTR_TABLE)) { + ptr_table_free(PL_ptr_table); + PL_ptr_table = NULL; + } + + SvREFCNT_dec(param->stashes); /* orphaned? eg threads->new inside BEGIN or use */