diff --git a/libs/pbd/xml++.cc b/libs/pbd/xml++.cc index 598a7684b3..e09af7602b 100644 --- a/libs/pbd/xml++.cc +++ b/libs/pbd/xml++.cc @@ -770,16 +770,16 @@ static XMLSharedNodeList* find_impl(xmlXPathContext* ctxt, const string& xpath) xmlXPathObject* result = xmlXPathEval((const xmlChar*)xpath.c_str(), ctxt); if (!result) { - xmlXPathFreeContext(ctxt); xmlFreeDoc(ctxt->doc); + xmlXPathFreeContext(ctxt); throw XMLException("Invalid XPath: " + xpath); } if (result->type != XPATH_NODESET) { xmlXPathFreeObject(result); - xmlXPathFreeContext(ctxt); xmlFreeDoc(ctxt->doc); + xmlXPathFreeContext(ctxt); throw XMLException("Only nodeset result types are supported."); }