Z_Malloc calls corrected