Bug 1492472 - add error checking to avoid crash in nsNNTPProtocol::LoadUrlInternal. r+a=jorgk
authorMagnus Melin <mkmelin+mozilla@iki.fi>
Fri, 28 Sep 2018 14:26:16 +0300
changeset 31831 5f75afd42c246c54b0b616703783c6c082539703
parent 31830 340ae0cd525b4112fb417b4492b15d27ced3d237
child 31832 64c7a63a96ad905bd259b9f148e52239ab1634d4
push id82
push usermozilla@jorgk.com
push dateSun, 30 Sep 2018 18:28:17 +0000
treeherdercomm-esr60@ffe79787a654 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1492472
Bug 1492472 - add error checking to avoid crash in nsNNTPProtocol::LoadUrlInternal. r+a=jorgk
mailnews/news/src/nsNNTPProtocol.cpp
--- a/mailnews/news/src/nsNNTPProtocol.cpp
+++ b/mailnews/news/src/nsNNTPProtocol.cpp
@@ -1140,22 +1140,25 @@ nsNNTPProtocol::OnProxyAvailable(nsICanc
   return rv;
 }
 
 nsresult
 nsNNTPProtocol::LoadUrlInternal(nsIProxyInfo* aProxyInfo)
 {
   m_proxyRequest = nullptr;
 
-  nsCOMPtr<nsIMsgIncomingServer> server = do_QueryInterface(m_nntpServer);
+  nsresult rv;
+  nsCOMPtr<nsIMsgIncomingServer> server = do_QueryInterface(m_nntpServer, &rv);
+  NS_ENSURE_SUCCESS(rv, rv);
+
   nsCString hostName;
   int32_t port = 0;
   int32_t socketType;
 
-  nsresult rv = server->GetRealHostName(hostName);
+  rv = server->GetRealHostName(hostName);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = m_url->GetPort(&port);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = server->GetSocketType(&socketType);
   NS_ENSURE_SUCCESS(rv, rv);