tenderlove/nokogiri — comment on commit c6bffc7056dc51f90f06faea3e5683cacfa6d1c4
File:  line 0
By tenderlove:

TBH, I think this should be considered a bug in libxml2. They should probably unlink the node before freeing the list, or at least saving the pointers (like I'm doing in this patch).