Fixed a calloc getting freed before being used