From 62fdd43d6599fc1c54c869aae075f1bb153314d6 Mon Sep 17 00:00:00 2001 From: Junji Sawada Date: Sun, 17 Jun 2012 21:35:32 +0900 Subject: RStruct.ptr must allocate members size --- src/struct.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/struct.c') diff --git a/src/struct.c b/src/struct.c index 5d759776f..8e9804cbc 100644 --- a/src/struct.c +++ b/src/struct.c @@ -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); -- cgit v1.2.3