Remove discareded NULL checks.
Use mrb_malloc() instead of mrb_realloc().
Merge pull request #2566 from cubicdaiya/issues/null_check

Remove discareded NULL checks and use mrb_malloc() instead of mrb_realloc().