summaryrefslogtreecommitdiff
path: root/svgio
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-01-22 11:38:33 +0000
committerCaolán McNamara <caolanm@redhat.com>2018-01-22 18:20:33 +0100
commit54cc0edd576968e6bc67dfd3831c63876db7fe58 (patch)
treecf9a1ae23ca20fe8bdcfa9cdc19eddce28834c8d /svgio
parent7b129f55b4da9a20581fe805b7dacadcb6386252 (diff)
ofz#5565 Indirect-leak
Change-Id: I7e201494edcf128389951e09ccfb6c7fc1e53315 Reviewed-on: https://gerrit.libreoffice.org/48309 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svgio')
-rw-r--r--svgio/source/svgreader/svgdocumenthandler.cxx10
1 files changed, 8 insertions, 2 deletions
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 (!)");
}