Converted all client malloc to calloc