diff --git a/netwerk/base/src/nsIOService.cpp b/netwerk/base/src/nsIOService.cpp index 9849a1318f4..8c722607044 100644 --- a/netwerk/base/src/nsIOService.cpp +++ b/netwerk/base/src/nsIOService.cpp @@ -107,6 +107,8 @@ static nsresult GetScheme(const char* inURI, char* *scheme) { // search for something up to a colon, and call it the scheme + NS_ASSERTION(inURI, "null pointer"); + if (!inURI) return NS_ERROR_NULL_POINTER; char c; const char* URI = inURI; PRUint32 i = 0; diff --git a/netwerk/util/src/nsNeckoUtil.cpp b/netwerk/util/src/nsNeckoUtil.cpp index 3c51e6e9c0c..068a32ab26e 100644 --- a/netwerk/util/src/nsNeckoUtil.cpp +++ b/netwerk/util/src/nsNeckoUtil.cpp @@ -41,7 +41,11 @@ NS_NewURI(nsIURI* *result, const nsString& spec, nsIURI* baseURI) // XXX we need a strategy to deal w/ unicode specs (if there should // XXX even be such a thing) const char* specStr = spec.GetBuffer(); + if (!specStr) + specStr = spec.ToNewCString(); // this forces a single byte char* nsresult rv = NS_NewURI(result, specStr, baseURI); + if (specStr) + nsCRT::free((char*)specStr); return rv; } @@ -86,7 +90,8 @@ NS_OpenURI(nsIStreamListener* aConsumer, nsIURI* uri, rv = serv->NewChannelFromURI("load", uri, nsnull, &channel); if (NS_FAILED(rv)) return rv; - rv = channel->AsyncRead(0, -1, uri, // uri used as context + rv = channel->AsyncRead(0, -1, + channel, // channel as the context (the nsDocLoader expects this) aConsumer); if (NS_FAILED(rv)) goto done;