Bug 1517464 - Fix crash in SMTP DTOR by properly initialising/testing pointer. r=aceman
authorJorg K <jorgk@jorgk.com>
Sat, 05 Jan 2019 13:58:23 +0100
changeset 33266 03e39bc0bc42504367a90a9318fb1401831bf631
parent 33265 49f231df703018392d6f8b99a3596057e3ade0de
child 33267 0498136de60462e313b89bffc00a931714c654f9
push id2368
push userclokep@gmail.com
push dateMon, 28 Jan 2019 21:12:50 +0000
treeherdercomm-beta@56d23c07d815 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaceman
bugs1517464
Bug 1517464 - Fix crash in SMTP DTOR by properly initialising/testing pointer. r=aceman
mailnews/compose/src/nsSmtpProtocol.cpp
--- a/mailnews/compose/src/nsSmtpProtocol.cpp
+++ b/mailnews/compose/src/nsSmtpProtocol.cpp
@@ -218,23 +218,24 @@ esmtp_value_encode(const char *addr)
 ///////////////////////////////////////////////////////////////////////////////////////////
 
 NS_IMPL_ISUPPORTS_INHERITED(nsSmtpProtocol, nsMsgAsyncWriteProtocol,
                             msgIOAuth2ModuleListener,
                             nsIProtocolProxyCallback)
 
 nsSmtpProtocol::nsSmtpProtocol(nsIURI * aURL)
     : nsMsgAsyncWriteProtocol(aURL)
+    , m_dataBuf(nullptr)
 {
 }
 
 nsSmtpProtocol::~nsSmtpProtocol()
 {
   // free our local state
-  PR_Free(m_dataBuf);
+  PR_FREEIF(m_dataBuf);
 }
 
 nsresult nsSmtpProtocol::Initialize(nsIURI * aURL)
 {
     NS_ASSERTION(aURL, "invalid URL passed into Smtp Protocol");
     nsresult rv = NS_OK;
 
     m_flags = 0;