added frees to all mallocs