[cwscore-commit] CVS update: MODIFIED: . ...
Joe Bester
commit at globus.org
Wed May 10 14:04:17 CDT 2006
User: bester
Date: 06/05/10 14:04:17
Modified: . xmlreader.c
Removed: . SAX.loT
Log:
Fix memory error walking namespaces when reading raw xml into a buffer
Removed shouldn't-be-in-cvs-file SAX.loT
Revision Changes Path
1.10 +8 -18 libxml2/xmlreader.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: xmlreader.c
===================================================================
RCS file: /home/globdev/CVS/globus-packages/libxml2/xmlreader.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- xmlreader.c 13 Jan 2006 20:18:55 -0000 1.9
+++ xmlreader.c 10 May 2006 19:04:17 -0000 1.10
@@ -1676,9 +1676,9 @@
if (cur_node->type == XML_ELEMENT_NODE)
{
- xmlNsPtr * ns_list, tmp;
+ xmlNsPtr * ns_list;
xmlChar ** ns_prefixes;
- int i;
+ int i,j;
/* Canonicalize the XML when dumping so that the data can be used
* in other XML documents
@@ -1692,32 +1692,22 @@
if (ns_list != NULL)
{
- tmp = *ns_list;
-
- i = 0;
- while (tmp != NULL)
+ for (i = 0; ns_list[i] != NULL; i++)
{
- i++;
- tmp = tmp->next;
}
ns_prefixes = malloc((i+1) * sizeof(xmlChar*));
- tmp = *ns_list;
- i = 0;
-
- while (tmp != NULL)
+ for (i = 0, j = 0; ns_list[i] != NULL; i++)
{
- xmlNsPtr new_ns;
- if (tmp->prefix != NULL)
+ if (ns_list[i]->prefix != NULL)
{
- ns_prefixes[i++] = xmlStrdup(tmp->prefix);
+ ns_prefixes[j++] = xmlStrdup(ns_list[i]->prefix);
}
- xmlNewNs(node, tmp->href, tmp->prefix);
+ xmlNewNs(node, ns_list[i]->href, ns_list[i]->prefix);
- tmp = tmp->next;
}
- ns_prefixes[i++] = NULL;
+ ns_prefixes[j++] = NULL;
xmlFree(ns_list);
}
More information about the cwscore-commit
mailing list