Skip to content
Snippets Groups Projects
Commit 15bf4f1f authored by Richard Schwarting's avatar Richard Schwarting
Browse files

Element.vala: fix issue with freeing xmlAttr memory; don't be overzealous,...

Element.vala: fix issue with freeing xmlAttr memory; don't be overzealous, only free when we'd lose out-of-tree references; in-tree will be handled by xmlFreeDoc
parent 6f03bd2f
Branches
Tags
No related merge requests found
......@@ -156,12 +156,18 @@ namespace GXml {
saved_attr = this.node->set_prop (propname, attr.node_value);
}
// Replace the old out-of-tree attr with the newly allocated one in the tree, that way xmlFreeDoc can clean up correctly
/* Replace an old out-of-tree attr with the newly
* allocated one in the tree, that way xmlFreeDoc can
* clean up correctly */
if (attr.node->parent == null) {
/* If it was in-tree, xmlSetProp should correctly handle the
memory when updating the value within its xmlAttr */
attr.node->free ();
attr.node = saved_attr;
}
}
}
}
/* Constructors */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment