Commit a843de0e authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto

Merge pull request #294 from junjis0203/fix_Struct_initialize

RStruct.ptr must allocate members size
parents f89215c7 62fdd43d
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment