Added Free statements for all mallocs