Bug 916580 - Fix bugs related to the usage of calloc. r=luke, a=bajaj