]> git.vpit.fr Git - perl/modules/Lexical-Types.git/commitdiff
Correct the refcount of the source SVs that aren't actually stored
authorVincent Pit <vince@profvince.com>
Sat, 4 Jul 2009 11:46:48 +0000 (13:46 +0200)
committerVincent Pit <vince@profvince.com>
Sat, 4 Jul 2009 11:46:48 +0000 (13:46 +0200)
Types.xs

index a560b2df6d7c22e5e1a06755323f2b0b8ed421ea..6a159bcdc2775cc517d8c11275237a197a934a0f 100644 (file)
--- 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;