Changeset: 9585e323d700 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/9585e323d700 Modified Files: monetdb5/modules/atoms/url.c Branch: default Log Message:
Small missing checks diffs (81 lines): diff --git a/monetdb5/modules/atoms/url.c b/monetdb5/modules/atoms/url.c --- a/monetdb5/modules/atoms/url.c +++ b/monetdb5/modules/atoms/url.c @@ -835,7 +835,7 @@ extractURLHost(str *retval, str *url, bi if ((s = skip_scheme(*url)) != NULL && (s = skip_authority(s, NULL, NULL, &h, &p)) != NULL && h != NULL) - { + { ssize_t l; const char *pos = s; const char *domain = NULL; @@ -861,24 +861,21 @@ extractURLHost(str *retval, str *url, bi } // clean up if not valid UTF-8 if (!checkUTF8(*retval)) { - // printf("%s\n", h); GDKfree(*retval); *retval = GDKstrdup(str_nil); } - } else { - throw(MAL, "url.getURLHost", SQLSTATE(HY013) MAL_MALLOC_FAIL); } } else { - // printf("%s\n", h); *retval = GDKstrdup(str_nil); } - } else { *retval = GDKstrdup(str_nil); } } else { *retval = GDKstrdup(str_nil); } + if (!*retval) + throw(MAL, "url.getURLHost", SQLSTATE(HY013) MAL_MALLOC_FAIL); return MAL_SUCCEED; } @@ -899,8 +896,7 @@ BATextractURLHost(bat *res, const bat *b const char *s; const char *host = NULL; const char *port = NULL; - BAT *bn = NULL; - BAT *b = BATdescriptor(*bid); + BAT *bn = NULL, *b = NULL; BUN p, q; size_t buflen = INITIAL_STR_BUFFER_LENGTH; str buf = GDKmalloc(buflen); @@ -910,16 +906,19 @@ BATextractURLHost(bat *res, const bat *b if (buf == NULL) throw(MAL, "baturl.extractURLHost", SQLSTATE(HY013) MAL_MALLOC_FAIL); - if (b == NULL) + if (!(b = BATdescriptor(*bid))) { + GDKfree(buf); throw(MAL, "baturl.extractURLHost", SQLSTATE(HY002) RUNTIME_OBJECT_MISSING); + } if ((bn = COLnew(b->hseqbase, TYPE_str, BATcount(b), TRANSIENT)) == NULL) { + GDKfree(buf); + BBPunfix(b->batCacheid); throw(MAL, "baturl.extractURLHost", SQLSTATE(HY013) MAL_MALLOC_FAIL); - BBPunfix(b->batCacheid); } BATiter bi = bat_iterator(b); BATloop(b, p, q) { - const char *url = (const char *) BUNtail(bi, p); + const char *url = (const char *) BUNtvar(bi, p); if (strNil(url)) { if (bunfastapp_nocheckVAR(bn, str_nil) != GDK_SUCCEED) { msg = createException(MAL, "baturl.extractURLHost", SQLSTATE(HY013) MAL_MALLOC_FAIL ); @@ -930,7 +929,7 @@ BATextractURLHost(bat *res, const bat *b if ((s = skip_scheme(url)) != NULL && (s = skip_authority(s, NULL, NULL, &host, &port)) != NULL && host != NULL) - { + { ssize_t l; const char *pos = s; const char *domain = NULL; _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org