RStruct.ptr must allocate members size

This commit is contained in:
Junji Sawada
2012-06-17 21:35:32 +09:00
parent f89215c7d2
commit 62fdd43d65
+1 -1
View File
@@ -412,7 +412,7 @@ mrb_struct_initialize_withArg(mrb_state *mrb, int argc, mrb_value *argv, mrb_val
mrb_raise(mrb, E_ARGUMENT_ERROR, "struct size differs");
}
st = RSTRUCT(self);
st->ptr = mrb_malloc(mrb, sizeof(mrb_value)*argc);
st->ptr = mrb_calloc(mrb, sizeof(mrb_value), n);
st->len = n;
memcpy(st->ptr, argv, sizeof(mrb_value)*argc);