From: Vincent Pit Date: Sat, 4 Jul 2009 11:46:48 +0000 (+0200) Subject: Correct the refcount of the source SVs that aren't actually stored X-Git-Tag: v0.08~4 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FLexical-Types.git;a=commitdiff_plain;h=4a583842927b16471bea479730a14b0cfc82eba5 Correct the refcount of the source SVs that aren't actually stored --- diff --git a/Types.xs b/Types.xs index a560b2d..6a159bc 100644 --- a/Types.xs +++ b/Types.xs @@ -330,8 +330,8 @@ typedef struct { OP *(*pp_padsv)(pTHX); } lt_op_info; -STATIC void lt_map_store(pPTBLMS_ const OP *o, SV *orig_pkg, SV *type_pkg, SV *type_meth, OP *(*pp_padsv)(pTHX)) { -#define lt_map_store(O, OP, TP, TM, PP) lt_map_store(aPTBLMS_ (O), (OP), (TP), (TM), (PP)) +STATIC void lt_map_store(pTHX_ const OP *o, SV *orig_pkg, SV *type_pkg, SV *type_meth, OP *(*pp_padsv)(pTHX)) { +#define lt_map_store(O, OP, TP, TM, PP) lt_map_store(aTHX_ (O), (OP), (TP), (TM), (PP)) lt_op_info *oi; #ifdef USE_ITHREADS @@ -373,6 +373,9 @@ STATIC void lt_map_store(pPTBLMS_ const OP *o, SV *orig_pkg, SV *type_pkg, SV *t oi->orig_pkg_len = op_len; oi->type_pkg_len = tp_len; oi->type_meth_len = tm_len; + SvREFCNT_dec(orig_pkg); + SvREFCNT_dec(type_pkg); + SvREFCNT_dec(type_meth); } #else /* MULTIPLICITY */ oi->orig_pkg = orig_pkg;