many further little changes for OOM problems. Now seems to be getting
* SAX2.c, encoding.c, error.c, parser.c, tree.c, uri.c, xmlIO.c,
xmlreader.c, include/libxml/tree.h: many further little changes
for OOM problems. Now seems to be getting closer to "ok".
* testOOM.c: added code to intercept more errors, found more
problems with library. Changed method of flagging / counting
errors intercepted.
diff --git a/uri.c b/uri.c
index d9dc760..10e7db6 100644
--- a/uri.c
+++ b/uri.c
@@ -1409,8 +1409,8 @@
}
path = (char *) xmlMallocAtomic(len + 1);
if (path == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlParseURIPathSegments: out of memory\n");
+ xmlGenericError(xmlGenericErrorContext,
+ "xmlParseURIPathSegments: out of memory\n");
*str = cur;
return (-1);
}
@@ -2202,7 +2202,7 @@
p = uri->path + 1;
strncpy(p, path, len + 1);
} else {
- uri->path = xmlStrdup(path);
+ uri->path = xmlStrdup(path); /* FIXME - check alloc! */
p = uri->path;
}
while (*p != '\0') {
@@ -2213,7 +2213,10 @@
#else
uri->path = (char *) xmlStrdup((const xmlChar *) path);
#endif
-
+ if (uri->path == NULL) {
+ xmlFreeURI(uri);
+ return(NULL);
+ }
ret = xmlSaveUri(uri);
xmlFreeURI(uri);
return(ret);