(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.