Fix memory leak in XML documentation