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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Tue Jan 19 19:53:54 UTC 2021


 sc/source/filter/excel/xistyle.cxx |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

New commits:
commit c1182f889946cb5d999ac84b447e33f5dcb759d6
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Jan 19 11:19:44 2021 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Jan 19 20:53:06 2021 +0100

    ofz#29713 Direct-leak
    
    Change-Id: I6acec28ac5ebfe5e266b8dc6ff355eb4dbd6fc6c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109626
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx
index 5a0ca78592d3..e92e868afca5 100644
--- a/sc/source/filter/excel/xistyle.cxx
+++ b/sc/source/filter/excel/xistyle.cxx
@@ -1576,9 +1576,11 @@ void XclImpXFBuffer::ReadXF( XclImpStream& rStrm )
 
 void XclImpXFBuffer::ReadStyle( XclImpStream& rStrm )
 {
-    XclImpStyle* pStyle = new XclImpStyle( GetRoot() );
-    pStyle->ReadStyle( rStrm );
-    (pStyle->IsBuiltin() ? maBuiltinStyles : maUserStyles).push_back( std::unique_ptr<XclImpStyle>(pStyle) );
+    std::unique_ptr<XclImpStyle> xStyle(std::make_unique<XclImpStyle>(GetRoot()));
+    xStyle->ReadStyle(rStrm);
+    XclImpStyleList& rStyleList = (xStyle->IsBuiltin() ? maBuiltinStyles : maUserStyles);
+    rStyleList.emplace_back(std::move(xStyle));
+    XclImpStyle* pStyle = rStyleList.back().get();
     OSL_ENSURE( maStylesByXf.count( pStyle->GetXfId() ) == 0, "XclImpXFBuffer::ReadStyle - multiple styles with equal XF identifier" );
     maStylesByXf[ pStyle->GetXfId() ] = pStyle;
 }


More information about the Libreoffice-commits mailing list