diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2012-06-17 07:28:08 -0700 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2012-06-17 07:28:08 -0700 |
| commit | a843de0e90750557a30261b8008253a58baa429e (patch) | |
| tree | 200b0326e88a82f76fc8591ddec0eda7badfb13f /src/struct.c | |
| parent | f89215c7d20bb305cc22a504cbb931f8ec9114cf (diff) | |
| parent | 62fdd43d6599fc1c54c869aae075f1bb153314d6 (diff) | |
| download | mruby-a843de0e90750557a30261b8008253a58baa429e.tar.gz mruby-a843de0e90750557a30261b8008253a58baa429e.zip | |
Merge pull request #294 from junjis0203/fix_Struct_initialize
RStruct.ptr must allocate members size
Diffstat (limited to 'src/struct.c')
| -rw-r--r-- | src/struct.c | 2 |
1 files changed, 1 insertions, 1 deletions
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); |
