replace malloc and realloc
Merge pull request #16 from shun-honda/replaceMalloc

replaced malloc and realloc