(MRI) Fixed a memory leak in fragment parsing.

Closes #856. This is an altered version of 5e04845, with the addition
of setting node->next to NULL before adding unlinked nodes to the
document via xmlAddChild().