Pickup calloc changes from vincenzo.
Merge pull request #717 from ktf/calloc-in-xz

Calloc in xz