Bug 1359369 - prevent null pointer dereference in NS_GetIsDocumentChannel. r?valentin
MozReview-Commit-ID: I1iu2miXmjZ
--- a/netwerk/base/nsNetUtil.cpp
+++ b/netwerk/base/nsNetUtil.cpp
@@ -361,20 +361,20 @@ NS_NewChannel(nsIChannel **out
nsresult
NS_GetIsDocumentChannel(nsIChannel * aChannel, bool *aIsDocument)
{
// Check if this channel is going to be used to create a document. If it has
// LOAD_DOCUMENT_URI set it is trivially creating a document. If
// LOAD_HTML_OBJECT_DATA is set it may or may not be used to create a
// document, depending on its MIME type.
- *aIsDocument = false;
if (!aChannel || !aIsDocument) {
return NS_ERROR_NULL_POINTER;
}
+ *aIsDocument = false;
nsLoadFlags loadFlags;
nsresult rv = aChannel->GetLoadFlags(&loadFlags);
if (NS_FAILED(rv)) {
return rv;
}
if (loadFlags & nsIChannel::LOAD_DOCUMENT_URI) {
*aIsDocument = true;
return NS_OK;