diff options
author | Matt Valentine-House <[email protected]> | 2021-11-10 22:42:40 +0000 |
---|---|---|
committer | Peter Zhu <[email protected]> | 2021-11-11 08:54:48 -0500 |
commit | c53aecee3bec524b91d7f2534291802a1cabb3f5 (patch) | |
tree | b905e87ada1b2d1748cc2839b69b26fb7a181e7a /gc.c | |
parent | b5531adf4160304ca62b7d128af458704c9beb4e (diff) |
fix a memory leak introduced in 8bbd319
This commit fixes a memory leak introduced in an early part of the
variable width allocation project that would prevent the rb_classext_t
struct from being free'd when the class is swept.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/5103
Diffstat (limited to 'gc.c')
-rw-r--r-- | gc.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -3141,8 +3141,10 @@ obj_free(rb_objspace_t *objspace, VALUE obj) } rb_class_remove_from_module_subclasses(obj); rb_class_remove_from_super_subclasses(obj); +#if !USE_RVARGC if (RCLASS_EXT(obj)) - RCLASS_EXT(obj) = NULL; + xfree(RCLASS_EXT(obj)); +#endif (void)RB_DEBUG_COUNTER_INC_IF(obj_module_ptr, BUILTIN_TYPE(obj) == T_MODULE); (void)RB_DEBUG_COUNTER_INC_IF(obj_class_ptr, BUILTIN_TYPE(obj) == T_CLASS); @@ -3308,7 +3310,9 @@ obj_free(rb_objspace_t *objspace, VALUE obj) cc_table_free(objspace, obj, FALSE); rb_class_remove_from_module_subclasses(obj); rb_class_remove_from_super_subclasses(obj); - RCLASS_EXT(obj) = NULL; +#if !USE_RVARGC + xfree(RCLASS_EXT(obj)); +#endif RB_DEBUG_COUNTER_INC(obj_iclass_ptr); break; |