summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederic Peters <fpeters@entrouvert.com>2007-05-02 12:42:12 +0000
committerFrederic Peters <fpeters@entrouvert.com>2007-05-02 12:42:12 +0000
commit78111f06c8fdcde413df2e49adc3aa00640dd294 (patch)
tree07de19381fdb364750777d46e60eadcb6b752eab
parent0777f98fde76c30be996f07a93eefdf144c2d7a6 (diff)
downloadlasso-78111f06c8fdcde413df2e49adc3aa00640dd294.tar.gz
lasso-78111f06c8fdcde413df2e49adc3aa00640dd294.tar.xz
lasso-78111f06c8fdcde413df2e49adc3aa00640dd294.zip
fixed xmlCleanNs on recursing namespaces
-rw-r--r--lasso/xml/xml.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/lasso/xml/xml.c b/lasso/xml/xml.c
index a88cdeef..46ba112d 100644
--- a/lasso/xml/xml.c
+++ b/lasso/xml/xml.c
@@ -2179,18 +2179,22 @@ lasso_node_init_from_saml2_query_fields(LassoNode *node, char **query_fields, ch
static void
xmlDeclareNs(xmlNode *root_node, xmlNode *node)
{
- xmlNs *ns;
+ xmlNs *ns, *ns2;
xmlNode *t;
if (strcmp((char*)node->name, "Signature") == 0)
return;
- for (ns = node->nsDef; ns; ns = ns->next)
- if (ns->prefix && strcmp((char*)ns->prefix, "xsi") != 0)
- xmlNewNs(root_node, ns->href, ns->prefix);
- for (t = node->children; t; t = t->next)
- if (t->type == XML_ELEMENT_NODE)
+ for (ns = node->nsDef; ns; ns = ns->next) {
+ if (ns->prefix && strcmp((char*)ns->prefix, "xsi") != 0) {
+ ns2 = xmlNewNs(root_node, ns->href, ns->prefix);
+ }
+ }
+ for (t = node->children; t; t = t->next) {
+ if (t->type == XML_ELEMENT_NODE) {
xmlDeclareNs(root_node, t);
+ }
+ }
}
static inline int
@@ -2227,14 +2231,13 @@ xmlUseNsDef(xmlNs *ns, xmlNode *node)
} else if (node->nsDef) {
for (ns2 = node->nsDef; ns2->next; ns2 = ns2->next) {
if (sameNs(ns2->next, ns)) {
+ ns3 = ns2->next;
ns2->next = ns2->next->next;
- if (ns3 != NULL) {
- xmlFreeNs(ns3);
- }
- ns3 = ns2;
+ xmlFreeNs(ns3);
+ if (ns2->next == NULL)
+ break;
}
}
- /* FIXME : memory leak : ns3 should be freed here */
}
}