svg_loader SvgLoader: Copy the missing composite url
authorJunsuChoi <jsuya.choi@samsung.com>
Tue, 22 Jun 2021 07:07:55 +0000 (16:07 +0900)
committerJunsuChoi <jsuya.choi@samsung.com>
Thu, 24 Jun 2021 00:26:30 +0000 (09:26 +0900)
When copying an attribute, url information of stype's composite is overwritten with memcpy.
This causes double free by deleting the wrong string in freeNodeStyle.

src/loaders/svg/tvgSvgLoader.cpp

index 1fd6250..883d96b 100644 (file)
@@ -1587,6 +1587,9 @@ static void _copyAttr(SvgNode* to, const SvgNode* from)
     //Copy style attribute;
     memcpy(to->style, from->style, sizeof(SvgStyleProperty));
 
+    //Copy style composite attribute (clip-path, mask, ...)
+    if (from->style->comp.url) to->style->comp.url = new string(from->style->comp.url->c_str());
+
     //Copy node attribute
     switch (from->type) {
         case SvgNodeType::Circle: {