replace malloc with calloc for array allocation for #9147