Added calloc error handling