summaryrefslogtreecommitdiff
path: root/gc.c
diff options
context:
space:
mode:
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/gc.c b/gc.c
index 4a96127bf21..92f2e37e17f 100644
--- a/gc.c
+++ b/gc.c
@@ -2501,7 +2501,9 @@ obj_free(rb_objspace_t *objspace, VALUE obj)
case T_MODULE:
case T_CLASS:
rb_clear_cache_by_class((VALUE)obj);
- rb_free_m_table(RCLASS_M_TBL(obj));
+ if (RCLASS_M_TBL(obj)) {
+ rb_free_m_table(RCLASS_M_TBL(obj));
+ }
if (RCLASS_IV_TBL(obj)) {
st_free_table(RCLASS_IV_TBL(obj));
}