Author: jmb
Date: Thu Jun 29 23:04:56 2006
New Revision: 2678
URL:
http://svn.semichrome.net?rev=2678&view=rev
Log:
Fix crash when url_* fails
Modified:
trunk/netsurf/content/fetch.c
Modified: trunk/netsurf/content/fetch.c
URL:
http://svn.semichrome.net/trunk/netsurf/content/fetch.c?rev=2678&r1=2...
==============================================================================
--- trunk/netsurf/content/fetch.c (original)
+++ trunk/netsurf/content/fetch.c Thu Jun 29 23:04:56 2006
@@ -315,24 +315,32 @@
return 0;
res = url_host(url, &host);
- /* we only fail memory exhaustion */
- if (res == URL_FUNC_NOMEM)
- goto failed;
- if (!host)
- host = strdup("");
- 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;
+
+ host = strdup("");
+ if (!host)
+ goto failed;
+ }
+
+ res = url_scheme(url, &ref1);
+ 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));