Bug 1492472 - add error checking to avoid crash in nsNNTPProtocol::LoadUrlInternal. r=jorgk
authorMagnus Melin <mkmelin+mozilla@iki.fi>
Fri, 28 Sep 2018 14:26:16 +0300
changeset 24843 ea04f95d5ceb814eeb22e47d72b5e3fa5418ce46
parent 24842 42792e593b1acf771d6a8ef560663d6a60162d3d
child 24844 2727ba9a62aa40c4eef3eea56ea8ca21b7555900
push id14946
push usermozilla@jorgk.com
push dateFri, 28 Sep 2018 17:03:48 +0000
treeherdercomm-central@ea04f95d5ceb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorgk
bugs1492472
Bug 1492472 - add error checking to avoid crash in nsNNTPProtocol::LoadUrlInternal. r=jorgk
mailnews/news/src/nsNNTPProtocol.cpp
--- a/mailnews/news/src/nsNNTPProtocol.cpp
+++ b/mailnews/news/src/nsNNTPProtocol.cpp
@@ -1136,22 +1136,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);