Bug 1517464 - Fix crash in SMTP DTOR by properly initialising/testing pointer. r=aceman a=jorgk
authorJorg K <jorgk@jorgk.com>
Sat, 05 Jan 2019 13:58:23 +0100
changeset 33926 ec30d1b23b43a57e1a18eaded23c7a043a44136f
parent 33925 1fbabef66920197989ddf3d0114578d222d8ced1
child 33927 c45fa8a5db0c4a538ff650a91b93a4e825d9f742
push id388
push userclokep@gmail.com
push dateMon, 28 Jan 2019 20:54:56 +0000
reviewersaceman, jorgk
bugs1517464
Bug 1517464 - Fix crash in SMTP DTOR by properly initialising/testing pointer. r=aceman a=jorgk
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;