replace malloc with calloc