Bug 1311251 - null check for mFD before use it. r=mayhemer a=gchang
authorShih-Chiang Chien <schien@mozilla.com>
Tue, 29 Nov 2016 11:37:18 +0800
changeset 357170 4b75f0404cd63a7179e6787f6fc2b75539bde93e
parent 357169 45df2ac398960c9e2b3ad13c18683db7fe49cd97
child 357171 4eb8ecd6fe80f5f2b5467169388dd673c223389a
push id6769
push usercbook@mozilla.com
push dateThu, 12 Jan 2017 15:16:20 +0000
treeherdermozilla-beta@5fb0834eba17 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmayhemer, gchang
bugs1311251
milestone51.0
Bug 1311251 - null check for mFD before use it. r=mayhemer a=gchang MozReview-Commit-ID: 8ygi74Uhtmf
netwerk/base/nsUDPSocket.cpp
--- a/netwerk/base/nsUDPSocket.cpp
+++ b/netwerk/base/nsUDPSocket.cpp
@@ -689,16 +689,20 @@ fail:
 
 NS_IMETHODIMP
 nsUDPSocket::Connect(const NetAddr *aAddr)
 {
   UDPSOCKET_LOG(("nsUDPSocket::Connect [this=%p]\n", this));
 
   NS_ENSURE_ARG(aAddr);
 
+  if (NS_WARN_IF(!mFD)) {
+    return NS_ERROR_NOT_INITIALIZED;
+  }
+
   bool onSTSThread = false;
   mSts->IsOnCurrentThread(&onSTSThread);
   NS_ASSERTION(onSTSThread, "NOT ON STS THREAD");
   if (!onSTSThread) {
     return NS_ERROR_FAILURE;
   }
 
   PRNetAddr prAddr;