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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Wed May 19 18:10:36 UTC 2021


 sc/source/filter/inc/defnamesbuffer.hxx |    1 +
 sc/source/filter/oox/defnamesbuffer.cxx |    8 ++++++++
 2 files changed, 9 insertions(+)

New commits:
commit f8c1048eb437b1e685b76198165844e2ecc97a56
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed May 19 19:04:02 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed May 19 20:09:58 2021 +0200

    fix leak in oox import
    
    Change-Id: I5ff21841480d11c4bfae3c34fd12a6fb32e250e3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115823
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sc/source/filter/inc/defnamesbuffer.hxx b/sc/source/filter/inc/defnamesbuffer.hxx
index b0b3b1ee6baf..03eec97af201 100644
--- a/sc/source/filter/inc/defnamesbuffer.hxx
+++ b/sc/source/filter/inc/defnamesbuffer.hxx
@@ -87,6 +87,7 @@ class DefinedName : public DefinedNameBase
 {
 public:
     explicit            DefinedName( const WorkbookHelper& rHelper );
+    virtual ~DefinedName() override;
 
     /** Sets the attributes for this defined name from the passed attribute set. */
     void                importDefinedName( const AttributeList& rAttribs );
diff --git a/sc/source/filter/oox/defnamesbuffer.cxx b/sc/source/filter/oox/defnamesbuffer.cxx
index 5f1bc1c01bf4..a554ab9cd0f1 100644
--- a/sc/source/filter/oox/defnamesbuffer.cxx
+++ b/sc/source/filter/oox/defnamesbuffer.cxx
@@ -333,6 +333,14 @@ bool DefinedName::getAbsoluteRange( ScRange& orRange ) const
     return getFormulaParser().extractCellRange( orRange, aFTokenSeq );
 }
 
+DefinedName::~DefinedName()
+{
+    // this kind of field is owned by us - see lcl_addNewByNameAndTokens
+    if (mpScRangeData && maModel.mbHidden &&
+        (mcBuiltinId == BIFF_DEFNAME_CRITERIA || mcBuiltinId == BIFF_DEFNAME_FILTERDATABASE))
+        delete mpScRangeData;
+}
+
 
 DefinedNamesBuffer::DefinedNamesBuffer( const WorkbookHelper& rHelper ) :
     WorkbookHelper( rHelper )


More information about the Libreoffice-commits mailing list