XML: Fix seg-fault bug introduced in commit 4108

* lasso/xml/xml.c:
   lasso_node_get_xmlnode_for_any_type is broken, if no original_xmlnode
   is present, return just cur. Also add all missing cases for the state
   of the pair (cur, orignal_xmlnode).
 * tests/basic_tests.c:
   add a non-regression test, testing all dump/restore functions.
This commit is contained in:
Benjamin Dauvergne 2009-09-11 15:51:53 +00:00
parent 4074c22a13
commit 1f78831973
2 changed files with 1690 additions and 7 deletions

View File

@ -2604,12 +2604,20 @@ lasso_node_get_xmlnode_for_any_type(LassoNode *node, xmlNode *cur)
xmlNode *original_xmlnode;
original_xmlnode = lasso_node_get_original_xmlnode(node);
if (original_xmlnode) {
return xmlCopyNode(original_xmlnode, 1);
if (cur) {
if (original_xmlnode) {
xmlNode *children = xmlCopyNodeList(original_xmlnode->children);
xmlCopyPropList(cur, original_xmlnode->properties);
xmlAddChildList(cur, children);
return cur;
} else {
return cur;
}
} else {
xmlNode *children = xmlCopyNodeList(original_xmlnode->children);
xmlCopyPropList(cur, original_xmlnode->properties);
xmlAddChildList(cur, children);
return cur;
if (original_xmlnode) {
return xmlCopyNode(original_xmlnode, 1);
} else {
return cur;
}
}
}

File diff suppressed because it is too large Load Diff