[Libreoffice-commits] core.git: xmlsecurity/source

Norbert Thiebaud nthiebaud at gmail.com
Thu Feb 21 23:48:06 PST 2013


 xmlsecurity/source/xmlsec/saxhelper.cxx |   53 +++++++++++++++-----------------
 1 file changed, 26 insertions(+), 27 deletions(-)

New commits:
commit 21f13f91f905d606687f113c4c0c90c6aa6c1196
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Mon Feb 18 03:19:29 2013 -0600

    coverity#705976 coverity#7074977
    
    Change-Id: Iaedb5fcd87a24f478d7c4a9c25e32cd2d0ee55da
    Reviewed-on: https://gerrit.libreoffice.org/2221
    Reviewed-by: Norbert Thiebaud <nthiebaud at gmail.com>
    Tested-by: Norbert Thiebaud <nthiebaud at gmail.com>

diff --git a/xmlsecurity/source/xmlsec/saxhelper.cxx b/xmlsecurity/source/xmlsec/saxhelper.cxx
index dbf1b37..5bac10d 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() ;
     }


More information about the Libreoffice-commits mailing list