diff options
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -2027,8 +2027,12 @@ rb_stat_become(obj, orig) struct stat *nst; /* need better argument type check */ - if (!rb_obj_is_kind_of(orig, rb_obj_class(obj))) { - rb_raise(rb_eTypeError, "wrong argument type"); + if (!rb_obj_is_instance_of(orig, rb_obj_class(obj))) { + rb_raise(rb_eTypeError, "wrong argument class"); + } + if (DATA_PTR(obj)) { + free(DATA_PTR(obj)); + DATA_PTR(obj) = 0; } if (DATA_PTR(orig)) { nst = ALLOC(struct stat); |