mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-11 15:12:08 +00:00
svg_loader: fixing memory leak
The css style node was improperly freed.
This commit is contained in:
parent
0a1606aed3
commit
23ea4ed9f1
2 changed files with 4 additions and 1 deletions
|
@ -2632,6 +2632,7 @@ static void _svgLoaderParserXmlOpen(SvgLoaderData* loader, const char* content,
|
||||||
if (!strcmp(tagName, "style")) {
|
if (!strcmp(tagName, "style")) {
|
||||||
node = method(loader, nullptr, attrs, attrsLength, simpleXmlParseAttributes);
|
node = method(loader, nullptr, attrs, attrsLength, simpleXmlParseAttributes);
|
||||||
loader->cssStyle = node;
|
loader->cssStyle = node;
|
||||||
|
loader->doc->node.doc.style = node;
|
||||||
loader->style = true;
|
loader->style = true;
|
||||||
} else {
|
} else {
|
||||||
node = method(loader, parent, attrs, attrsLength, simpleXmlParseAttributes);
|
node = method(loader, parent, attrs, attrsLength, simpleXmlParseAttributes);
|
||||||
|
@ -2931,6 +2932,7 @@ static void _freeNode(SvgNode* node)
|
||||||
}
|
}
|
||||||
case SvgNodeType::Doc: {
|
case SvgNodeType::Doc: {
|
||||||
_freeNode(node->node.doc.defs);
|
_freeNode(node->node.doc.defs);
|
||||||
|
_freeNode(node->node.doc.style);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SvgNodeType::Defs: {
|
case SvgNodeType::Defs: {
|
||||||
|
|
|
@ -153,6 +153,7 @@ struct SvgDocNode
|
||||||
float vw;
|
float vw;
|
||||||
float vh;
|
float vh;
|
||||||
SvgNode* defs;
|
SvgNode* defs;
|
||||||
|
SvgNode* style;
|
||||||
bool preserveAspect;
|
bool preserveAspect;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -405,7 +406,7 @@ struct SvgNodeIdPair
|
||||||
|
|
||||||
struct SvgLoaderData
|
struct SvgLoaderData
|
||||||
{
|
{
|
||||||
Array<SvgNode *> stack = {nullptr, 0, 0};
|
Array<SvgNode*> stack = {nullptr, 0, 0};
|
||||||
SvgNode* doc = nullptr;
|
SvgNode* doc = nullptr;
|
||||||
SvgNode* def = nullptr;
|
SvgNode* def = nullptr;
|
||||||
SvgNode* cssStyle = nullptr;
|
SvgNode* cssStyle = nullptr;
|
||||||
|
|
Loading…
Add table
Reference in a new issue