зеркало из https://github.com/mozilla/pjs.git
426450 - PKIX_PL_HashTable_Remove leaks hashtable key object. r=nelson
This commit is contained in:
Родитель
44907b7ff4
Коммит
481f3af757
|
@ -834,7 +834,6 @@ pkix_CacheCertChain_Add(
|
|||
PKIX_List *cachedValues = NULL;
|
||||
PKIX_List *cachedKeys = NULL;
|
||||
PKIX_Error *cachedCertChainError = NULL;
|
||||
PKIX_PL_Date *date = NULL;
|
||||
PKIX_PL_Date *cacheValidUntilDate = NULL;
|
||||
|
||||
PKIX_ENTER(BUILD, "pkix_CacheCertChain_Add");
|
||||
|
@ -894,7 +893,6 @@ cleanup:
|
|||
PKIX_DECREF(cachedKeys);
|
||||
PKIX_DECREF(cachedCertChainError);
|
||||
PKIX_DECREF(cacheValidUntilDate);
|
||||
PKIX_DECREF(date);
|
||||
|
||||
PKIX_RETURN(BUILD);
|
||||
}
|
||||
|
|
|
@ -304,7 +304,8 @@ PKIX_PL_HashTable_Remove(
|
|||
void *plContext)
|
||||
{
|
||||
PKIX_PL_Mutex *lockedMutex = NULL;
|
||||
PKIX_PL_Object *result = NULL;
|
||||
PKIX_PL_Object *origKey = NULL;
|
||||
PKIX_PL_Object *value = NULL;
|
||||
PKIX_UInt32 hashCode;
|
||||
PKIX_PL_EqualsCallback keyComp;
|
||||
|
||||
|
@ -335,15 +336,15 @@ PKIX_PL_HashTable_Remove(
|
|||
(void *)key,
|
||||
hashCode,
|
||||
keyComp,
|
||||
(void **)&result,
|
||||
(void **)&origKey,
|
||||
(void **)&value,
|
||||
plContext),
|
||||
PKIX_PRIMHASHTABLEREMOVEFAILED);
|
||||
|
||||
PKIX_MUTEX_UNLOCK(ht->tableLock);
|
||||
|
||||
if (result != NULL) {
|
||||
PKIX_DECREF(result);
|
||||
}
|
||||
PKIX_DECREF(origKey);
|
||||
PKIX_DECREF(value);
|
||||
|
||||
/*
|
||||
* we don't call PKIX_PL_InvalidateCache here b/c we have
|
||||
|
@ -405,9 +406,7 @@ PKIX_PL_HashTable_Lookup(
|
|||
|
||||
PKIX_MUTEX_UNLOCK(ht->tableLock);
|
||||
|
||||
if (result != NULL) {
|
||||
PKIX_INCREF(result);
|
||||
}
|
||||
PKIX_INCREF(result);
|
||||
*pResult = result;
|
||||
|
||||
cleanup:
|
||||
|
|
|
@ -302,7 +302,8 @@ pkix_pl_PrimHashTable_Remove(
|
|||
void *key,
|
||||
PKIX_UInt32 hashCode,
|
||||
PKIX_PL_EqualsCallback keyComp,
|
||||
void **pResult,
|
||||
void **pKey,
|
||||
void **pValue,
|
||||
void *plContext)
|
||||
{
|
||||
pkix_pl_HT_Elem *element = NULL;
|
||||
|
@ -310,7 +311,10 @@ pkix_pl_PrimHashTable_Remove(
|
|||
PKIX_Boolean compResult;
|
||||
|
||||
PKIX_ENTER(HASHTABLE, "pkix_pl_PrimHashTable_Remove");
|
||||
PKIX_NULLCHECK_THREE(ht, key, pResult);
|
||||
PKIX_NULLCHECK_FOUR(ht, key, pKey, pValue);
|
||||
|
||||
*pKey = NULL;
|
||||
*pValue = NULL;
|
||||
|
||||
for (element = ht->buckets[hashCode%ht->size], prior = element;
|
||||
(element != NULL);
|
||||
|
@ -344,7 +348,8 @@ pkix_pl_PrimHashTable_Remove(
|
|||
} else {
|
||||
ht->buckets[hashCode%ht->size] = element->next;
|
||||
}
|
||||
*pResult = element->value;
|
||||
*pKey = element->key;
|
||||
*pValue = element->value;
|
||||
element->key = NULL;
|
||||
element->value = NULL;
|
||||
element->next = NULL;
|
||||
|
@ -353,9 +358,6 @@ pkix_pl_PrimHashTable_Remove(
|
|||
}
|
||||
}
|
||||
|
||||
/* if we've reached here, specified key doesn't exist in hashtable */
|
||||
*pResult = NULL;
|
||||
|
||||
cleanup:
|
||||
|
||||
PKIX_RETURN(HASHTABLE);
|
||||
|
|
|
@ -95,7 +95,8 @@ pkix_pl_PrimHashTable_Remove(
|
|||
void *key,
|
||||
PKIX_UInt32 hashCode,
|
||||
PKIX_PL_EqualsCallback keyComp,
|
||||
void **pResult,
|
||||
void **pKey,
|
||||
void **pValue,
|
||||
void *plContext);
|
||||
|
||||
PKIX_Error *
|
||||
|
|
Загрузка…
Ссылка в новой задаче