Permalink
Browse files

Fix leak on re-entrancy

  • Loading branch information...
1 parent 51e68cd commit f9274f005a0ec48b6b79aa75b04f2a0a1b58920d @tsee tsee committed Oct 25, 2012
Showing with 3 additions and 0 deletions.
  1. +1 −0 Perl/Encoder/srl_encoder.c
  2. +2 −0 Perl/Encoder/srl_encoder.h
@@ -445,6 +445,7 @@ srl_dump_data_structure(pTHX_ srl_encoder_t *enc, SV *src)
if (SRL_ENC_HAVE_OPER_FLAG(enc, SRL_OF_ENCODER_DIRTY)) {
srl_encoder_t * const proto = enc;
enc = srl_build_encoder_struct_alike(aTHX_ proto);
+ SRL_ENC_RESET_OPTION(enc, SRL_F_REUSE_ENCODER);
}
/* Set to being in use */;
SRL_ENC_SET_OPER_FLAG(enc, SRL_OF_ENCODER_DIRTY);
@@ -78,6 +78,8 @@ void srl_dump_data_structure(pTHX_ srl_encoder_t *enc, SV *src);
#define SRL_OF_ENCODER_DIRTY 1UL
#define SRL_ENC_HAVE_OPTION(enc, flag_num) ((enc)->flags & flag_num)
+#define SRL_ENC_SET_OPTION(enc, flag_num) STMT_START {(enc)->flags |= (flag_num);}STMT_END
+#define SRL_ENC_RESET_OPTION(enc, flag_num) STMT_START {(enc)->flags &= ~(flag_num);}STMT_END
#define SRL_ENC_HAVE_OPER_FLAG(enc, flag_num) ((enc)->operational_flags & (flag_num))
#define SRL_ENC_SET_OPER_FLAG(enc, flag_num) STMT_START {(enc)->operational_flags |= (flag_num);}STMT_END

0 comments on commit f9274f0

Please sign in to comment.