segfaults on free are often double-free's (where you've tried to "free" something that's already been free'd) or where something was NEVER malloc'd in the first place. You're going to need to trace...