Bug 1208405 - [CID 222166] leaked_storage: Variable rv going out of scope leaks the storage it points to, r=ekr
authorFranziskus Kiefer <franziskuskiefer@gmail.com>
Tue, 20 Oct 2015 15:01:46 +0200
changeset 11689 4f05e85715d7a29b6ebaa836175234561f1072d6
parent 11688 4398610ede4721150a9c4837857b33e7852691cb
child 11690 bbbea9edea2b87c89262dd312d3156aca9a038a2
push id830
push userekr@mozilla.com
push dateTue, 20 Oct 2015 17:24:44 +0000
reviewersekr
bugs1208405, 222166
Bug 1208405 - [CID 222166] leaked_storage: Variable rv going out of scope leaks the storage it points to, r=ekr
lib/ckfw/hash.c
--- a/lib/ckfw/hash.c
+++ b/lib/ckfw/hash.c
@@ -80,19 +80,19 @@ nssCKFWHash_Create
   if (!rv) {
     *pError = CKR_HOST_MEMORY;
     return (nssCKFWHash *)NULL;
   }
 
   rv->mutex = nssCKFWInstance_CreateMutex(fwInstance, arena, pError);
   if (!rv->mutex) {
     if( CKR_OK == *pError ) {
-      (void)nss_ZFreeIf(rv);
       *pError = CKR_GENERAL_ERROR;
     }
+    (void)nss_ZFreeIf(rv);
     return (nssCKFWHash *)NULL;
   }
 
   rv->plHashTable = PL_NewHashTable(0, nss_ckfw_identity_hash, 
     PL_CompareValues, PL_CompareValues, &nssArenaHashAllocOps, arena);
   if (!rv->plHashTable) {
     (void)nssCKFWMutex_Destroy(rv->mutex);
     (void)nss_ZFreeIf(rv);