check d->type before accessing d->type->dfree; #1474 #858

This commit is contained in:
Yukihiro "Matz" Matsumoto
2013-08-14 16:51:50 +09:00
parent b7d6b4d0ce
commit f8454e53ba
+1 -1
View File
@@ -646,7 +646,7 @@ obj_free(mrb_state *mrb, struct RBasic *obj)
case MRB_TT_DATA:
{
struct RData *d = (struct RData*)obj;
if (d->type->dfree) {
if (d->type && d->type->dfree) {
d->type->dfree(mrb, d->data);
}
mrb_gc_free_iv(mrb, (struct RObject*)obj);