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

Julien Nabet serval2412 at yahoo.fr
Sat Oct 7 12:36:31 UTC 2017


 sw/source/filter/ww8/docxexport.cxx |   42 ++++++++++++++++++------------------
 1 file changed, 21 insertions(+), 21 deletions(-)

New commits:
commit 7c757ade47bc47008d1292aac4989cfc995c3470
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Sat Oct 7 13:37:00 2017 +0200

    cid#1418980: Resource leak
    
    Since https://cgit.freedesktop.org/libreoffice/core/commit/?id=2694162969cf86ef366d3ce812fccd0630acc800
    
    Change-Id: I4a48279f3d073160041b66dbcf148118588f8712
    Reviewed-on: https://gerrit.libreoffice.org/43229
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index 4ecd04f7d425..b57d24acbdb1 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -1030,34 +1030,34 @@ void DocxExport::WriteSettings()
             }
             else if (propList[i].Name == "DocumentProtection")
             {
-                sax_fastparser::FastAttributeList* pAttributeList = sax_fastparser::FastSerializerHelper::createAttrList();
 
                 uno::Sequence< beans::PropertyValue > rAttributeList;
                 propList[i].Value >>= rAttributeList;
 
-                for (sal_Int32 j = 0; j < rAttributeList.getLength(); ++j)
+                if (rAttributeList.getLength())
                 {
-                    static DocxStringTokenMap const aTokens[] =
+                    sax_fastparser::FastAttributeList* pAttributeList = sax_fastparser::FastSerializerHelper::createAttrList();
+                    for (sal_Int32 j = 0; j < rAttributeList.getLength(); ++j)
                     {
-                        { "edit",                XML_edit },
-                        { "enforcement",         XML_enforcement },
-                        { "formatting",          XML_formatting },
-                        { "cryptProviderType",   XML_cryptProviderType },
-                        { "cryptAlgorithmClass", XML_cryptAlgorithmClass },
-                        { "cryptAlgorithmType",  XML_cryptAlgorithmType },
-                        { "cryptAlgorithmSid",   XML_cryptAlgorithmSid },
-                        { "cryptSpinCount",      XML_cryptSpinCount },
-                        { "hash",                XML_hash },
-                        { "salt",                XML_salt },
-                        { nullptr, 0 }
-                    };
-
-                    if (sal_Int32 nToken = DocxStringGetToken(aTokens, rAttributeList[j].Name))
-                        pAttributeList->add(FSNS(XML_w, nToken), rAttributeList[j].Value.get<OUString>().toUtf8());
-                }
+                        static DocxStringTokenMap const aTokens[] =
+                        {
+                            { "edit",                XML_edit },
+                            { "enforcement",         XML_enforcement },
+                            { "formatting",          XML_formatting },
+                            { "cryptProviderType",   XML_cryptProviderType },
+                            { "cryptAlgorithmClass", XML_cryptAlgorithmClass },
+                            { "cryptAlgorithmType",  XML_cryptAlgorithmType },
+                            { "cryptAlgorithmSid",   XML_cryptAlgorithmSid },
+                            { "cryptSpinCount",      XML_cryptSpinCount },
+                            { "hash",                XML_hash },
+                            { "salt",                XML_salt },
+                            { nullptr, 0 }
+                        };
+
+                        if (sal_Int32 nToken = DocxStringGetToken(aTokens, rAttributeList[j].Name))
+                            pAttributeList->add(FSNS(XML_w, nToken), rAttributeList[j].Value.get<OUString>().toUtf8());
+                    }
 
-                if (rAttributeList.getLength())
-                {
                     // we have document protection from from input DOCX file
 
                     sax_fastparser::XFastAttributeListRef xAttributeList(pAttributeList);


More information about the Libreoffice-commits mailing list