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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Thu Apr 2 10:08:41 UTC 2020


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

New commits:
commit bedce5f2b383c38b8fe051e4e63b76e116c5ffb4
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Apr 2 09:25:02 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Apr 2 12:07:59 2020 +0200

    cid#1418980 Resource leak
    
    Change-Id: I3a09b3165503bacbd2bab394eda9adc793f0bff9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91546
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index f9af8d2937cf..035f50cbeaac 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -1210,7 +1210,7 @@ void DocxExport::WriteSettings()
 
                 if (rAttributeList.hasElements())
                 {
-                    sax_fastparser::FastAttributeList* pAttributeList = sax_fastparser::FastSerializerHelper::createAttrList();
+                    rtl::Reference<sax_fastparser::FastAttributeList> xAttributeList = sax_fastparser::FastSerializerHelper::createAttrList();
                     bool bIsProtectionTrackChanges = false;
                     // if grabbag protection is not enforced, allow Writer protection to override
                     bool bEnforced = false;
@@ -1234,7 +1234,7 @@ void DocxExport::WriteSettings()
                         if (sal_Int32 nToken = DocxStringGetToken(aTokens, rAttribute.Name))
                         {
                             OUString sValue = rAttribute.Value.get<OUString>();
-                            pAttributeList->add(FSNS(XML_w, nToken), sValue.toUtf8());
+                            xAttributeList->add(FSNS(XML_w, nToken), sValue.toUtf8());
                             if ( nToken == XML_edit && sValue == "trackedChanges" )
                                 bIsProtectionTrackChanges = true;
                             else if ( nToken == XML_edit && sValue == "readOnly" )
@@ -1264,8 +1264,8 @@ void DocxExport::WriteSettings()
 
                     if ( bUseGrabBagProtection )
                     {
-                        sax_fastparser::XFastAttributeListRef xAttributeList(pAttributeList);
-                        pFS->singleElementNS(XML_w, XML_documentProtection, xAttributeList);
+                        sax_fastparser::XFastAttributeListRef xFastAttributeList(xAttributeList.get());
+                        pFS->singleElementNS(XML_w, XML_documentProtection, xFastAttributeList);
                     }
 
                 }


More information about the Libreoffice-commits mailing list