From a3215c7ae6b1441ceb046c61cc93a70a74bd7f9c Mon Sep 17 00:00:00 2001 From: "William M. Brack" Date: Sat, 31 Jul 2004 16:24:01 +0000 Subject: 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. --- uri.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'uri.c') diff --git a/uri.c b/uri.c index d9dc760a..10e7db67 100644 --- a/uri.c +++ b/uri.c @@ -1409,8 +1409,8 @@ xmlParseURIPathSegments(xmlURIPtr uri, const char **str, int slash) } 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 @@ xmlCanonicPath(const xmlChar *path) 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 @@ xmlCanonicPath(const xmlChar *path) #else uri->path = (char *) xmlStrdup((const xmlChar *) path); #endif - + if (uri->path == NULL) { + xmlFreeURI(uri); + return(NULL); + } ret = xmlSaveUri(uri); xmlFreeURI(uri); return(ret); -- cgit v1.2.1