am 1ff91085: am 52e7d3d9: Bulletproof leak dump against null hash entries

Merge commit '1ff910858c8ae5863761101c673a196a6a16bca3'

* commit '1ff910858c8ae5863761101c673a196a6a16bca3':
  Bulletproof leak dump against null hash entries
This commit is contained in:
Christopher Tate 2010-08-09 19:57:25 -07:00 committed by Android Git Automerger
commit caaf7ecd1c

View File

@ -60,9 +60,17 @@ HashTable gHashTable;
static int hash_entry_compare(const void* arg1, const void* arg2)
{
int result;
HashEntry* e1 = *(HashEntry**)arg1;
HashEntry* e2 = *(HashEntry**)arg2;
// if one or both arg pointers are null, deal gracefully
if (e1 == NULL) {
result = (e2 == NULL) ? 0 : 1;
} else if (e2 == NULL) {
result = -1;
} else {
size_t nbAlloc1 = e1->allocations;
size_t nbAlloc2 = e2->allocations;
size_t size1 = e1->size & ~SIZE_FLAG_MASK;
@ -90,6 +98,7 @@ static int hash_entry_compare(const void* arg1, const void* arg2)
result = 0;
}
}
}
return result;
}