Bug 1017826 - prevent a potential memory leak in OCSPCache::Put. r=keeler
authorHarsh Pathak <hpathak@mozilla.com>
Mon, 16 Jun 2014 20:27:00 +0200
changeset 188981 a624df7becd2b6d2ddf6e02dbae1e2004ba42499
parent 188980 0f2821706cdbaa72e770bc4b5009b49c7a25d8cb
child 188982 0d1f547d353d0b87424c3612a4ee7d292ffd16c6
push id26972
push usercbook@mozilla.com
push dateTue, 17 Jun 2014 12:05:18 +0000
treeherdermozilla-central@888d54549b20 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskeeler
bugs1017826
milestone33.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1017826 - prevent a potential memory leak in OCSPCache::Put. r=keeler
security/certverifier/OCSPCache.cpp
--- a/security/certverifier/OCSPCache.cpp
+++ b/security/certverifier/OCSPCache.cpp
@@ -281,16 +281,17 @@ OCSPCache::Put(const CERTCertificate* aC
   // be fatal, so handle this case.
   if (!newEntry) {
     PR_SetError(SEC_ERROR_NO_MEMORY, 0);
     return SECFailure;
   }
   SECStatus rv = newEntry->Init(aCert, aIssuerCert, aErrorCode, aThisUpdate,
                                 aValidThrough);
   if (rv != SECSuccess) {
+      delete newEntry;
     return rv;
   }
   mEntries.append(newEntry);
   LogWithCerts("OCSPCache::Put(%s, %s) added to cache", aCert, aIssuerCert);
   return SECSuccess;
 }
 
 void