From 7979c009a762d9b447f7ef286af2d314b7c11a6c Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Fri, 27 Oct 2023 11:00:12 -0400 Subject: [PATCH] Fix bug for removed weak references rb_darray_foreach gives a pointer to the entry, so we need to deference it to read the value. --- gc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gc.c b/gc.c index fce9202d9f..6f13ff9284 100644 --- a/gc.c +++ b/gc.c @@ -8281,7 +8281,7 @@ gc_update_weak_references(rb_objspace_t *objspace) size_t retained_weak_references_count = 0; VALUE **ptr_ptr; rb_darray_foreach(objspace->weak_references, i, ptr_ptr) { - if (!ptr_ptr) continue; + if (!*ptr_ptr) continue; VALUE obj = **ptr_ptr;