end of first pass on coverity reports. Daniel
* runtest.c schematron.c testAutomata.c tree.c valid.c xinclude.c
xmlcatalog.c xmlreader.c xmlregexp.c xpath.c: end of first
pass on coverity reports.
Daniel
diff --git a/schematron.c b/schematron.c
index 98184ac..0a90ff8 100644
--- a/schematron.c
+++ b/schematron.c
@@ -1044,11 +1044,10 @@
if (doc != NULL)
xmlFreeDoc(doc);
}
- if (href == NULL)
- xmlFree(href);
- if (base == NULL)
+ xmlFree(href);
+ if (base != NULL)
xmlFree(base);
- if (URI == NULL)
+ if (URI != NULL)
xmlFree(URI);
return(ret);
}
@@ -1207,13 +1206,15 @@
if (!preserve) {
xmlFreeDoc(doc);
}
- if (ctxt->nberrors != 0) {
- xmlSchematronFree(ret);
- ret = NULL;
- } else {
- ret->namespaces = ctxt->namespaces;
- ret->nbNamespaces = ctxt->nbNamespaces;
- ctxt->namespaces = NULL;
+ if (ret != NULL) {
+ if (ctxt->nberrors != 0) {
+ xmlSchematronFree(ret);
+ ret = NULL;
+ } else {
+ ret->namespaces = ctxt->namespaces;
+ ret->nbNamespaces = ctxt->nbNamespaces;
+ ctxt->namespaces = NULL;
+ }
}
return (ret);
}
@@ -1519,7 +1520,7 @@
do {
cur = cur->parent;
- if (cur == NULL) return(NULL);
+ if (cur == NULL) break;
if (cur->type == XML_DOCUMENT_NODE) return(NULL);
if (cur->next != NULL) {
cur = cur->next;