Subject: bug#28590: [PATCH 4/7] weak-table: Always unregister previous links when inserting an entry.

From: Ludovic Courtès <[email-masked]>
Date: Tue, 3 Oct 2017 13:43:49 +0200

* libguile/weak-table.c (weak_table_put_x): Always call
'unregister_disappearing_links' before returning.
---
 libguile/weak-table.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libguile/weak-table.c b/libguile/weak-table.c
index 7d8633165..b5db3ef48 100644
--- a/libguile/weak-table.c
+++ b/libguile/weak-table.c
@@ -731,9 +731,9 @@ weak_table_put_x (scm_t_weak_table *table, unsigned long hash,
       return;
     }
 
-  if (entries[k].hash)
-    unregister_disappearing_links (&entries[k], table->kind);
-  else
+  unregister_disappearing_links (&entries[k], table->kind);
+
+  if (!entries[k].hash)
     table->n_items++;
 
   entries[k].hash = hash;
-- 
2.14.2