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

Caolán McNamara caolanm at redhat.com
Mon Jan 22 17:21:00 UTC 2018


 svgio/source/svgreader/svgdocumenthandler.cxx |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

New commits:
commit 54cc0edd576968e6bc67dfd3831c63876db7fe58
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Jan 22 11:38:33 2018 +0000

    ofz#5565 Indirect-leak
    
    Change-Id: I7e201494edcf128389951e09ccfb6c7fc1e53315
    Reviewed-on: https://gerrit.libreoffice.org/48309
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/svgio/source/svgreader/svgdocumenthandler.cxx b/svgio/source/svgreader/svgdocumenthandler.cxx
index 60fab9e84e45..8288a40be6ce 100644
--- a/svgio/source/svgreader/svgdocumenthandler.cxx
+++ b/svgio/source/svgreader/svgdocumenthandler.cxx
@@ -144,10 +144,16 @@ namespace svgio
 
         SvgDocHdl::~SvgDocHdl()
         {
-            if(mpTarget)
+            if (mpTarget)
             {
                 OSL_ENSURE(false, "SvgDocHdl destructed with active target (!)");
-                delete mpTarget;
+
+                while (mpTarget->getParent())
+                    mpTarget = const_cast< SvgNode* >(mpTarget->getParent());
+
+                const SvgNodeVector& rOwnedTopLevels = maDocument.getSvgNodeVector();
+                if (std::find(rOwnedTopLevels.begin(), rOwnedTopLevels.end(), mpTarget) == rOwnedTopLevels.end())
+                    delete mpTarget;
             }
             OSL_ENSURE(!maCssContents.size(), "SvgDocHdl destructed with active css style stack entry (!)");
         }


More information about the Libreoffice-commits mailing list