From 7e7e2dde2403ad6d5b265ca541d15a51402e6bae Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Tue, 21 Nov 2023 09:19:15 -0500 Subject: Fix memory leak when evacuating generic ivars The lookup in the table is using the wrong key when converting generic instance variables to too complex, which means that it never looks up the entry which leaks memory when the entry is overwritten. --- variable.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'variable.c') diff --git a/variable.c b/variable.c index b6c9cc3e0d..f155f7e712 100644 --- a/variable.c +++ b/variable.c @@ -1379,7 +1379,7 @@ rb_obj_convert_to_too_complex(VALUE obj, st_table *table) RB_VM_LOCK_ENTER(); { struct st_table *gen_ivs = generic_ivtbl_no_ractor_check(obj); - st_lookup(gen_ivs, (st_data_t)&obj, (st_data_t *)&old_ivptr); + st_lookup(gen_ivs, (st_data_t)obj, (st_data_t *)&old_ivptr); struct gen_ivtbl *ivtbl = xmalloc(sizeof(struct gen_ivtbl)); ivtbl->as.complex.table = table; -- cgit v1.2.3