Fixed a memory leak: xmlSchemaFreeAnnot() was only freeing the first
* xmlschemas.c: Fixed a memory leak: xmlSchemaFreeAnnot() was
only freeing the first annotation in the list.
diff --git a/ChangeLog b/ChangeLog
index 1468b72..3a71697 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Mon Aug 8 14:40:52 CEST 2005 Kasimier Buchcik <libxml2-cvs@cazic.net>
+
+ * xmlschemas.c: Fixed a memory leak: xmlSchemaFreeAnnot() was
+ only freeing the first annotation in the list.
+
Mon Aug 8 09:44:34 CEST 2005 Daniel Veillard <daniel@veillard.com>
* xmlreader.c: applied patch from Rob Richards fixing
diff --git a/xmlschemas.c b/xmlschemas.c
index db30dc9..3ee5563 100644
--- a/xmlschemas.c
+++ b/xmlschemas.c
@@ -2904,7 +2904,17 @@
{
if (annot == NULL)
return;
- xmlFree(annot);
+ if (annot->next == NULL) {
+ xmlFree(annot);
+ } else {
+ xmlSchemaAnnotPtr prev;
+
+ do {
+ prev = annot;
+ annot = annot->next;
+ xmlFree(prev);
+ } while (annot != NULL);
+ }
}
/**