shouldn't 'xmlFree' be under 'if (text_ptr)'