~ chicken-core (master) 062e866628f8c95b97f98e249985b7449304d111
commit 062e866628f8c95b97f98e249985b7449304d111
Author: felix <felix@call-with-current-continuation.org>
AuthorDate: Tue Sep 1 13:37:19 2026 +0200
Commit: felix <felix@call-with-current-continuation.org>
CommitDate: Tue Sep 1 13:37:19 2026 +0200
correctly restore finalizer to free list when unregistering
Report and fix by "crzcrz"
diff --git a/runtime.c b/runtime.c
index e1a6e9aa..3cfc32c9 100644
--- a/runtime.c
+++ b/runtime.c
@@ -11827,7 +11827,12 @@ int C_do_unregister_finalizer(C_word x)
if(flist->item == x) {
if(flist->previous == NULL) finalizer_list = flist->next;
else flist->previous->next = flist->next;
+ if(flist->next != NULL) flist->next->previous = flist->previous;
+ flist->next = finalizer_free_list;
+ flist->previous = NULL;
+ finalizer_free_list = flist;
+ --live_finalizer_count;
return 1;
}
}
Trap