If you see OS X generating some error like this at runtime:
App(7990,0×101294000) malloc: *** error for object 0x7f8f5c801038: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap: 6
You could be attempting to free something that wasn’t malloc’d by the C library. It’s a pretty-weird bug I just ran across while attempting to free the contents of a syscall-returned linked-list individually (not always the best idea, but in this case it would have made a particular problem easier to solve).
Note, this is definitely not a nullptr dereference or free(), it was a valid pointer in the linked-list chain, but I still hit an abort() call in the malloc library.