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

autovivification.xs

index d92b0b7b01bb92d6a94d7cc92f545ca2b79a609c..bc6857e4129fc92cfb47098417d5d974c88bdbfb 100644 (file)
@@ -215,8 +215,10 @@ STATIC void a_thread_cleanup(pTHX_ void *ud) {
 
 #if A_WORKAROUND_REQUIRE_PROPAGATION
  ptable_hints_free(MY_CXT.tbl);
+ MY_CXT.tbl  = NULL;
 #endif /* A_WORKAROUND_REQUIRE_PROPAGATION */
  ptable_seen_free(MY_CXT.seen);
+ MY_CXT.seen = NULL;
 }
 
 STATIC int a_endav_free(pTHX_ SV *sv, MAGIC *mg) {
@@ -1128,8 +1130,10 @@ STATIC void a_teardown(pTHX_ void *root) {
   dMY_CXT;
 # if A_THREADSAFE && A_WORKAROUND_REQUIRE_PROPAGATION
   ptable_hints_free(MY_CXT.tbl);
+  MY_CXT.tbl  = NULL;
 # endif /* A_THREADSAFE && A_WORKAROUND_REQUIRE_PROPAGATION */
   ptable_seen_free(MY_CXT.seen);
+  MY_CXT.seen = NULL;
  }
 
  a_ck_restore(OP_PADANY, &a_old_ck_padany);