are you also adding in corresponding "frees" for these mallocs?  They are needed.