Nullify thread local storage entries when they are freed
authorVincent Pit <vince@profvince.com>
Mon, 29 Sep 2014 15:19:14 +0000 (17:19 +0200)
committerVincent Pit <vince@profvince.com>
Mon, 29 Sep 2014 16:35:00 +0000 (18:35 +0200)
This makes possible problems easier to reproduce.

indirect.xs

index db56379..5cd420c 100644 (file)
@@ -327,8 +327,11 @@ STATIC void indirect_thread_cleanup(pTHX_ void *ud) {
  dMY_CXT;
 
  SvREFCNT_dec(MY_CXT.global_code);
+ MY_CXT.global_code = NULL;
  ptable_free(MY_CXT.map);
+ MY_CXT.map = NULL;
  ptable_hints_free(MY_CXT.tbl);
+ MY_CXT.tbl = NULL;
 }
 
 STATIC int indirect_endav_free(pTHX_ SV *sv, MAGIC *mg) {
@@ -930,8 +933,10 @@ STATIC void indirect_teardown(pTHX_ void *root) {
  {
   dMY_CXT;
   ptable_free(MY_CXT.map);
+  MY_CXT.map = NULL;
 #if I_THREADSAFE
   ptable_hints_free(MY_CXT.tbl);
+  MY_CXT.tbl = NULL;
 #endif
  }