summaryrefslogtreecommitdiffstats
path: root/src/misc/hash
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2008-04-03 08:01:00 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2008-04-03 08:01:00 -0700
commit087951655efdc20b5b4beb64b15edf86a27850a8 (patch)
tree4dbba88e1e7e4470478ad295dbc9cd829672a371 /src/misc/hash
parent0080244a89eaaccd64c64af8f394486ab5d3e5b5 (diff)
downloadabc-087951655efdc20b5b4beb64b15edf86a27850a8.tar.gz
abc-087951655efdc20b5b4beb64b15edf86a27850a8.tar.bz2
abc-087951655efdc20b5b4beb64b15edf86a27850a8.zip
Version abc80403
Diffstat (limited to 'src/misc/hash')
-rw-r--r--src/misc/hash/hashInt.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/misc/hash/hashInt.h b/src/misc/hash/hashInt.h
index 3b91f5df..b7ec8a8c 100644
--- a/src/misc/hash/hashInt.h
+++ b/src/misc/hash/hashInt.h
@@ -90,7 +90,7 @@ static inline Hash_Int_t * Hash_IntAlloc( int nBins )
p->nBins = nBins;
p->fHash = Hash_DefaultHashFunc;
p->nSize = 0;
- p->pArray = ALLOC( Hash_Int_Entry_t *, nBins );
+ p->pArray = ALLOC( Hash_Int_Entry_t *, nBins+1 );
for(i=0; i<nBins; i++)
p->pArray[i] = NULL;
@@ -270,17 +270,18 @@ static inline int* Hash_IntEntryPtr( Hash_Int_t *p, int key )
***********************************************************************/
static inline void Hash_IntFree( Hash_Int_t *p ) {
int bin;
- Hash_Int_Entry_t *pEntry;
+ Hash_Int_Entry_t *pEntry, *pTemp;
// free bins
for(bin = 0; bin < p->nBins; bin++) {
pEntry = p->pArray[bin];
while(pEntry) {
+ pTemp = pEntry;
pEntry = pEntry->pNext;
- FREE( pEntry );
+ FREE( pTemp );
}
}
-
+
// free hash
FREE( p->pArray );
FREE( p );