diff options
author | Norbert Thiebaud <nthiebaud@gmail.com> | 2013-02-18 03:19:29 -0600 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2013-02-22 07:47:47 +0000 |
commit | 21f13f91f905d606687f113c4c0c90c6aa6c1196 (patch) | |
tree | 024bd0f0f9e8dd0bebf4b7d1be9f65d99b248d86 /xmlsecurity | |
parent | d1dc850cbb6072d26a26aa8d183002a50c548cfc (diff) |
coverity#705976 coverity#7074977
Change-Id: Iaedb5fcd87a24f478d7c4a9c25e32cd2d0ee55da
Reviewed-on: https://gerrit.libreoffice.org/2221
Reviewed-by: Norbert Thiebaud <nthiebaud@gmail.com>
Tested-by: Norbert Thiebaud <nthiebaud@gmail.com>
Diffstat (limited to 'xmlsecurity')
-rw-r--r-- | xmlsecurity/source/xmlsec/saxhelper.cxx | 53 |
1 files changed, 26 insertions, 27 deletions
diff --git a/xmlsecurity/source/xmlsec/saxhelper.cxx b/xmlsecurity/source/xmlsec/saxhelper.cxx index dbf1b3704702..5bac10de7c8a 100644 --- a/xmlsecurity/source/xmlsec/saxhelper.cxx +++ b/xmlsecurity/source/xmlsec/saxhelper.cxx @@ -123,21 +123,6 @@ SAXHelper::SAXHelper( ) m_pParserCtxt = xmlNewParserCtxt() ; - /* - * i41748 - * - * mmi : re-initialize the SAX handler to version 1 - */ - - xmlSAXVersion(m_pParserCtxt->sax, 1); - - /* end */ - - if( m_pParserCtxt->inputTab[0] != NULL ) - { - m_pParserCtxt->inputTab[0] = NULL ; - } - if( m_pParserCtxt == NULL ) { #ifndef XMLSEC_NO_XSLT @@ -148,25 +133,35 @@ SAXHelper::SAXHelper( ) // xmlCleanupParser() ; throw cssu::RuntimeException() ; } - else if( m_pParserCtxt->sax == NULL ) + else { - xmlFreeParserCtxt( m_pParserCtxt ) ; + xmlSAXVersion(m_pParserCtxt->sax, 1); + + if( m_pParserCtxt->inputTab[0] != NULL ) + { + m_pParserCtxt->inputTab[0] = NULL ; + } + + if( m_pParserCtxt->sax == NULL ) + { + xmlFreeParserCtxt( m_pParserCtxt ) ; #ifndef XMLSEC_NO_XSLT - xsltCleanupGlobals() ; + xsltCleanupGlobals() ; #endif // see issue i74334, we cannot call xmlCleanupParser when libxml is still used // in other parts of the office. // xmlCleanupParser() ; - m_pParserCtxt = NULL ; - throw cssu::RuntimeException() ; - } - else - { - m_pSaxHandler = m_pParserCtxt->sax ; + m_pParserCtxt = NULL ; + throw cssu::RuntimeException() ; + } + else + { + m_pSaxHandler = m_pParserCtxt->sax ; - //Adjust the context - m_pParserCtxt->recovery = 1 ; + //Adjust the context + m_pParserCtxt->recovery = 1 ; + } } } @@ -233,6 +228,10 @@ xmlDocPtr SAXHelper::getDocument() void SAXHelper::startDocument( void ) throw( cssxs::SAXException , cssu::RuntimeException ) { + if( m_pParserCtxt == NULL) + { + throw cssu::RuntimeException() ; + } /* * Adjust inputTab */ @@ -246,7 +245,7 @@ void SAXHelper::startDocument( void ) m_pSaxHandler->startDocument( m_pParserCtxt ) ; - if( m_pParserCtxt == NULL || m_pParserCtxt->myDoc == NULL ) + if( m_pParserCtxt->myDoc == NULL ) { throw cssu::RuntimeException() ; } |