From 087951655efdc20b5b4beb64b15edf86a27850a8 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Thu, 3 Apr 2008 08:01:00 -0700 Subject: Version abc80403 --- src/misc/hash/hashInt.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/misc/hash') 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; ipArray[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 ); -- cgit v1.2.3