summaryrefslogtreecommitdiff
path: root/content/fetch.c
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2006-06-29 22:04:56 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2006-06-29 22:04:56 +0000
commit8c3e9b882be5b44e6708b997320073d8b78b7a8d (patch)
tree17c26f481615d1b334a2001ab7df3d00ffb9e3d7 /content/fetch.c
parentc5cb54b94d4b338a255f50e67fe6bd1a870691f1 (diff)
downloadnetsurf-8c3e9b882be5b44e6708b997320073d8b78b7a8d.tar.gz
netsurf-8c3e9b882be5b44e6708b997320073d8b78b7a8d.tar.bz2
Fix crash when url_* fails
svn path=/trunk/netsurf/; revision=2678
Diffstat (limited to 'content/fetch.c')
-rw-r--r--content/fetch.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/content/fetch.c b/content/fetch.c
index 44d326f92..19fafccbe 100644
--- a/content/fetch.c
+++ b/content/fetch.c
@@ -315,24 +315,32 @@ struct fetch * fetch_start(char *url, char *referer,
return 0;
res = url_host(url, &host);
- /* we only fail memory exhaustion */
- if (res == URL_FUNC_NOMEM)
- goto failed;
- if (!host)
+ if (res != URL_FUNC_OK) {
+ /* we only fail memory exhaustion */
+ if (res == URL_FUNC_NOMEM)
+ goto failed;
+
host = strdup("");
- if (!host)
- goto failed;
+ if (!host)
+ goto failed;
+ }
res = url_scheme(url, &ref1);
- /* we only fail memory exhaustion */
- if (res == URL_FUNC_NOMEM)
- goto failed;
-
- if (referer) {
- res = url_scheme(referer, &ref2);
+ if (res != URL_FUNC_OK) {
/* we only fail memory exhaustion */
if (res == URL_FUNC_NOMEM)
goto failed;
+ ref1 = NULL;
+ }
+
+ if (referer) {
+ res = url_scheme(referer, &ref2);
+ if (res != URL_FUNC_OK) {
+ /* we only fail memory exhaustion */
+ if (res == URL_FUNC_NOMEM)
+ goto failed;
+ ref2 = NULL;
+ }
}
LOG(("fetch %p, url '%s'", fetch, url));