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

Caolán McNamara caolanm at redhat.com
Sun Sep 17 16:21:11 UTC 2017


 xmloff/source/text/txtparai.cxx |   16 +++++++---------
 xmloff/source/text/txtparai.hxx |    2 +-
 2 files changed, 8 insertions(+), 10 deletions(-)

New commits:
commit 2729a1c9d34c2c32c73431b8a6bdf44df382658a
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Sep 17 12:07:12 2017 +0100

    valgrind: leak in fdo42771-1.fodt
    
     at 0x4C2E1FC: operator new(unsigned long) (vg_replace_malloc.c:334)
     by 0x148794C2: XMLParaContext::CreateChildContext(unsigned short, rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::xml::sax::XAttributeList> const&) (txtparai.cxx:2167)
     by 0x14517821: SvXMLImport::startElement(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::xml::sax::XAttributeList> const&) (xmlimp.cxx:704)
     by 0x14511B09: SvXMLImportContext::startUnknownElement(rtl::OUString const&, rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::xml::sax::XFastAttributeList> const&) (xmlictxt.cxx:127)
     by 0x145114AE: SvXMLImportContext::startFastElement(int, com::sun::star::uno::Reference<com::sun::star::xml::sax::XFastAttributeList> const&) (xmlictxt.cxx:77)
     by 0x14518654: SvXMLImport::startFastElement(int, com::sun::star::uno::Reference<com::sun::star::xml::sax::XFastAttributeList> const&) (xmlimp.cxx:854)
     by 0x463D934A: (anonymous namespace)::Entity::startElement((anonymous namespace)::Event*) (fastparser.cxx:456)
     by 0x463DD799: sax_fastparser::FastSaxParserImpl::callbackStartElement(unsigned char const*, unsigned char const*, unsigned char const*, int, unsigned char const**, int, unsigned char const**) (fastparser.cxx:1205)
     by 0x463D7956: call_callbackStartElement (fastparser.cxx:306)
     by 0x13F667FF: xmlParseStartTag2 (parser.c:9793)
     by 0x13F6D77C: xmlParseTryOrFinish (parser.c:11591)
     by 0x13F6EF6A: xmlParseChunk (parser.c:12496)
    
    Change-Id: I89a6a9035e7016d6d96a78e62dba42fb2f148258
    Reviewed-on: https://gerrit.libreoffice.org/42372
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/xmloff/source/text/txtparai.cxx b/xmloff/source/text/txtparai.cxx
index f7b947c3899d..ceeb57c9c260 100644
--- a/xmloff/source/text/txtparai.cxx
+++ b/xmloff/source/text/txtparai.cxx
@@ -1773,7 +1773,6 @@ XMLParaContext::XMLParaContext(
     xStart( rImport.GetTextImport()->GetCursorAsRange()->getStart() ),
     m_bHaveAbout(false),
     nOutlineLevel( IsXMLToken( rLName, XML_H ) ? 1 : -1 ),
-    pHints( nullptr ),
     // Lost outline numbering in master document (#i73509#)
     mbOutlineLevelAttrFound( false ),
     bIgnoreLeadingSpace( true ),
@@ -2009,9 +2008,9 @@ void XMLParaContext::EndElement()
         }
     }
 
-    if (pHints && !pHints->GetHints().empty())
+    if (m_xHints && !m_xHints->GetHints().empty())
     {
-        for (const auto & i : pHints->GetHints())
+        for (const auto & i : m_xHints->GetHints())
         {
             XMLHint_Impl *const pHint = i.get();
             xAttrCursor->gotoRange( pHint->GetStart(), false );
@@ -2153,7 +2152,7 @@ void XMLParaContext::EndElement()
             }
         }
     }
-    delete pHints;
+    m_xHints.reset();
 }
 
 SvXMLImportContext *XMLParaContext::CreateChildContext(
@@ -2163,13 +2162,12 @@ SvXMLImportContext *XMLParaContext::CreateChildContext(
     const SvXMLTokenMap& rTokenMap =
         GetImport().GetTextImport()->GetTextPElemTokenMap();
     sal_uInt16 nToken = rTokenMap.Get( nPrefix, rLocalName );
-    if( !pHints )
-        pHints = new XMLHints_Impl;
+    if (!m_xHints)
+        m_xHints.reset(new XMLHints_Impl);
     return XMLImpSpanContext_Impl::CreateChildContext(
                                 GetImport(), nPrefix, rLocalName, xAttrList,
-                                   nToken, *pHints, bIgnoreLeadingSpace
-                                , nStarFontsConvFlags
-                                                     );
+                                nToken, *m_xHints, bIgnoreLeadingSpace,
+                                nStarFontsConvFlags);
 }
 
 void XMLParaContext::Characters( const OUString& rChars )
diff --git a/xmloff/source/text/txtparai.hxx b/xmloff/source/text/txtparai.hxx
index 1f101cdda74a..e6d8f1b0c18a 100644
--- a/xmloff/source/text/txtparai.hxx
+++ b/xmloff/source/text/txtparai.hxx
@@ -44,7 +44,7 @@ class XMLParaContext : public SvXMLImportContext
     OUString             m_sDatatype;
     bool                 m_bHaveAbout;
     sal_Int8             nOutlineLevel;
-    XMLHints_Impl       *pHints;
+    std::unique_ptr<XMLHints_Impl> m_xHints;
     // Lost outline numbering in master document (#i73509#)
     bool                 mbOutlineLevelAttrFound;
     bool                 bIgnoreLeadingSpace;


More information about the Libreoffice-commits mailing list