diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2023-07-05 09:31:58 +0100 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2023-07-05 15:08:05 +0200 |
commit | 0dfd8288a87b58e503bb3a41be6137485fbf3f68 (patch) | |
tree | b5075be59231bda176d5e4f3c32d14351748779d /svgio | |
parent | 451f15888a7f3e747a34d24a047d4ec73a40c6c5 (diff) |
ofz#60384 Direct-leak
since:
commit 13a41e7a12598c7896d6dc8d34aba6af5b80b83c
Date: Mon Jul 3 14:11:43 2023 +0200
tdf#150124: do nothing when parent is of unkown type
Change-Id: I58edf5f63d97e8afb1cd58c7e23452a9ea6a87eb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154023
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'svgio')
-rw-r--r-- | svgio/inc/svgdocument.hxx | 6 | ||||
-rw-r--r-- | svgio/source/svgreader/svgnode.cxx | 9 |
2 files changed, 12 insertions, 3 deletions
diff --git a/svgio/inc/svgdocument.hxx b/svgio/inc/svgdocument.hxx index 9f79342c0c55..77b4d3891179 100644 --- a/svgio/inc/svgdocument.hxx +++ b/svgio/inc/svgdocument.hxx @@ -34,6 +34,9 @@ namespace svgio::svgreader /// the document hierarchy with all root nodes SvgNodeVector maNodes; + /// invalid nodes that have no parent + SvgNodeVector maOrphanNodes; + /// the absolute path of the Svg file in progress (if available) const OUString maAbsolutePath; @@ -72,6 +75,9 @@ namespace svgio::svgreader /// data read access const SvgNodeVector& getSvgNodeVector() const { return maNodes; } const OUString& getAbsolutePath() const { return maAbsolutePath; } + + /// invalid nodes that have no parent + void addOrphanNode(SvgNode* pOrphan) { maOrphanNodes.emplace_back(pOrphan); } }; } // end of namespace svgio::svgreader diff --git a/svgio/source/svgreader/svgnode.cxx b/svgio/source/svgreader/svgnode.cxx index d87c76d81e20..992aaf72bce0 100644 --- a/svgio/source/svgreader/svgnode.cxx +++ b/svgio/source/svgreader/svgnode.cxx @@ -395,10 +395,13 @@ namespace { mbDecomposing(false), mbCssStyleVectorBuilt(false) { - // tdf#150124 ignore when parent is unknown - if(pParent && pParent->getType() != SVGToken::Unknown) + if (pParent) { - pParent->maChildren.emplace_back(this); + // tdf#150124 ignore when parent is unknown + if (pParent->getType() != SVGToken::Unknown) + pParent->maChildren.emplace_back(this); + else + mrDocument.addOrphanNode(this); } } |