diff options
author | Rüdiger Timm <rt@openoffice.org> | 2008-07-08 08:42:15 +0000 |
---|---|---|
committer | Rüdiger Timm <rt@openoffice.org> | 2008-07-08 08:42:15 +0000 |
commit | ee50668e2f49dc30da485d3c242c52880c046c7e (patch) | |
tree | 2bfe1c3853cc448b101a1bb30ec5d1d82979c4e9 /unoxml | |
parent | b4668da08e7df22f5a90d44a36f3d00957f2f754 (diff) |
INTEGRATION: CWS fwk91 (1.6.6); FILE MERGED
2008/06/24 11:38:59 mst 1.6.6.1: fix #i90835#
- unoxml/source/dom/documentbuilder.cxx:
+ do not access freed xmlParserCtxt
Diffstat (limited to 'unoxml')
-rw-r--r-- | unoxml/source/dom/documentbuilder.cxx | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/unoxml/source/dom/documentbuilder.cxx b/unoxml/source/dom/documentbuilder.cxx index d556b431385e..7f6777620d87 100644 --- a/unoxml/source/dom/documentbuilder.cxx +++ b/unoxml/source/dom/documentbuilder.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: documentbuilder.cxx,v $ - * $Revision: 1.6 $ + * $Revision: 1.7 $ * * This file is part of OpenOffice.org. * @@ -316,6 +316,16 @@ namespace DOM } // extern "C" + void throwEx(xmlParserCtxtPtr ctxt) { + OUString msg = make_error_message(ctxt); + xmlFreeParserCtxt(ctxt); + com::sun::star::xml::sax::SAXParseException saxex; + saxex.Message = msg; + saxex.LineNumber = static_cast<sal_Int32>(ctxt->lastError.line); + saxex.ColumnNumber = static_cast<sal_Int32>(ctxt->lastError.int2); + throw saxex; + } + Reference< XDocument > SAL_CALL CDocumentBuilder::parse(const Reference< XInputStream >& is) throw (RuntimeException, SAXParseException, IOException) { @@ -345,15 +355,10 @@ namespace DOM xmlDocPtr pDoc = xmlCtxtReadIO(ctxt, xmlIO_read_func, xmlIO_close_func, &c, 0, 0, 0); - xmlFreeParserCtxt(ctxt); if (pDoc == 0) { - OUString msg = make_error_message(ctxt); - com::sun::star::xml::sax::SAXParseException saxex; - saxex.Message = msg; - saxex.LineNumber = static_cast<sal_Int32>(ctxt->lastError.line); - saxex.ColumnNumber = static_cast<sal_Int32>(ctxt->lastError.int2); - throw saxex; + throwEx(ctxt); } + xmlFreeParserCtxt(ctxt); return Reference< XDocument >(static_cast< CDocument* >(CNode::get((xmlNodePtr)pDoc))); } @@ -399,15 +404,10 @@ namespace DOM OString oUri = OUStringToOString(sUri, RTL_TEXTENCODING_UTF8); char *uri = (char*) oUri.getStr(); xmlDocPtr pDoc = xmlCtxtReadFile(ctxt, uri, 0, 0); - xmlFreeParserCtxt(ctxt); if (pDoc == 0) { - OUString msg = make_error_message(ctxt); - com::sun::star::xml::sax::SAXParseException saxex; - saxex.Message = msg; - saxex.LineNumber = static_cast<sal_Int32>(ctxt->lastError.line); - saxex.ColumnNumber = static_cast<sal_Int32>(ctxt->lastError.int2); - throw saxex; + throwEx(ctxt); } + xmlFreeParserCtxt(ctxt); return Reference< XDocument >(static_cast< CDocument* >(CNode::get((xmlNodePtr)pDoc))); } |