]> git.eshelyaron.com Git - emacs.git/commitdiff
* src/alloc.c (sweep_symbols): Tweak last change
authorStefan Monnier <monnier@iro.umontreal.ca>
Wed, 1 Nov 2017 17:36:58 +0000 (13:36 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Thu, 2 Nov 2017 14:03:16 +0000 (10:03 -0400)
Avoid the double-free without the extra check.  Add an explanatory comment.

src/alloc.c

index 11afdfd7cc064e09b66b68ad8c04f5f6eca7b93b..3f4ec168fa317118eff4a901f08db5a1bb13165f 100644 (file)
@@ -7024,10 +7024,16 @@ sweep_symbols (void)
         {
           if (!sym->s.gcmarkbit)
             {
-              if (sym->s.redirect == SYMBOL_LOCALIZED
-                 /* Already freed?  */
-                 && !EQ (sym->s.function, Vdead))
-                xfree (SYMBOL_BLV (&sym->s));
+              if (sym->s.redirect == SYMBOL_LOCALIZED)
+               {
+                  xfree (SYMBOL_BLV (&sym->s));
+                  /* At every GC we sweep all symbol_blocks and rebuild the
+                     symbol_free_list, so those symbols which stayed unused
+                     between the two will be re-swept.
+                     So we have to make sure we don't re-free this blv next
+                     time we sweep this symbol_block (bug#29066).  */
+                  sym->s.redirect == SYMBOL_PLAINVAL;
+                }
               sym->s.next = symbol_free_list;
               symbol_free_list = &sym->s;
               symbol_free_list->function = Vdead;