]> git.vpit.fr Git - perl/modules/Lexical-Types.git/commitdiff
Nullify thread local storage entries when they are freed
authorVincent Pit <vince@profvince.com>
Sat, 4 Oct 2014 22:39:58 +0000 (00:39 +0200)
committerVincent Pit <vince@profvince.com>
Sat, 4 Oct 2014 22:39:58 +0000 (00:39 +0200)
This makes possible problems easier to reproduce.

Types.xs

index a88ced75d9ce2ab1d500de72abbdde2f75d5becf..752e3f43d27aab4f5b1de8a8c59d1e70ab91f220 100644 (file)
--- a/Types.xs
+++ b/Types.xs
@@ -263,8 +263,11 @@ STATIC void lt_thread_cleanup(pTHX_ void *ud) {
  dMY_CXT;
 
  ptable_hints_free(MY_CXT.tbl);
+ MY_CXT.tbl          = NULL;
  ptable_seen_free(MY_CXT.seen);
+ MY_CXT.seen         = NULL;
  SvREFCNT_dec(MY_CXT.default_meth);
+ MY_CXT.default_meth = NULL;
 }
 
 STATIC int lt_endav_free(pTHX_ SV *sv, MAGIC *mg) {
@@ -934,9 +937,12 @@ STATIC void lt_teardown(pTHX_ void *root) {
   dMY_CXT;
 #if LT_THREADSAFE
   ptable_hints_free(MY_CXT.tbl);
+  MY_CXT.tbl          = NULL;
 #endif
   ptable_seen_free(MY_CXT.seen);
+  MY_CXT.seen         = NULL;
   SvREFCNT_dec(MY_CXT.default_meth);
+  MY_CXT.default_meth = NULL;
  }
 
  lt_ck_restore(OP_PADANY, &lt_old_ck_padany);