diff options
Diffstat (limited to 'uri.c')
-rw-r--r-- | uri.c | 19 |
1 files changed, 13 insertions, 6 deletions
@@ -46,10 +46,12 @@ */ #define IS_UPALPHA(x) (((x) >= 'A') && ((x) <= 'Z')) +#ifdef IS_DIGIT +#undef IS_DIGIT +#endif /* * digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" */ - #define IS_DIGIT(x) (((x) >= '0') && ((x) <= '9')) /* @@ -1407,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); } @@ -2122,6 +2124,8 @@ xmlBuildRelativeURI (const xmlChar * URI, const xmlChar * base) ix = xmlStrlen (uptr) + 1; val = (xmlChar *) xmlMalloc (ix + 3 * nbslash); if (val == NULL) { + xmlGenericError(xmlGenericErrorContext, + "xmlBuildRelativeURI: out of memory\n"); goto done; } vptr = val; @@ -2193,12 +2197,12 @@ xmlCanonicPath(const xmlChar *path) len = xmlStrlen(path); if ((len > 2) && IS_WINDOWS_PATH(path)) { uri->scheme = xmlStrdup(BAD_CAST "file"); - uri->path = xmlMallocAtomic(len + 2); + uri->path = xmlMallocAtomic(len + 2); /* FIXME - check alloc! */ uri->path[0] = '/'; 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') { @@ -2209,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); |