diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-08-27 23:48:06 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-08-27 23:48:06 +0900 |
| commit | 0d400477933f09f1017db5a87bd14ff4d9348cff (patch) | |
| tree | 8e55b2b0312274c9a6977a6576ae65ad1c0b297d /src/gc.c | |
| parent | ecda19f4024cd853d933b059ba9f082a42837096 (diff) | |
| parent | cc22ec85b9f1b6bf818fd8d456cc12e1460164c0 (diff) | |
| download | mruby-0d400477933f09f1017db5a87bd14ff4d9348cff.tar.gz mruby-0d400477933f09f1017db5a87bd14ff4d9348cff.zip | |
Merge pull request #2566 from cubicdaiya/issues/null_check
Remove discareded NULL checks and use mrb_malloc() instead of mrb_realloc().
Diffstat (limited to 'src/gc.c')
| -rw-r--r-- | src/gc.c | 6 |
1 files changed, 2 insertions, 4 deletions
@@ -227,11 +227,9 @@ mrb_calloc(mrb_state *mrb, size_t nelem, size_t len) nelem <= SIZE_MAX / len) { size_t size; size = nelem * len; - p = mrb_realloc(mrb, 0, size); + p = mrb_malloc(mrb, size); - if (p) { - memset(p, 0, size); - } + memset(p, 0, size); } else { p = NULL; |
