Skip to content

Commit

Permalink
Do not use recursive call to free hash item
Browse files Browse the repository at this point in the history
  • Loading branch information
czchen committed Sep 19, 2013
1 parent 4e980ae commit 6b84a18
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -445,14 +445,12 @@ static int migrate_hash_to_bin( ChewingData *pgdata )

static void FreeHashItem( HASH_ITEM *aItem )
{
if ( aItem ) {
HASH_ITEM *pItem = aItem->next;
while ( aItem ) {
HASH_ITEM *next = aItem->next;
free( aItem->data.phoneSeq );
free( aItem->data.wordSeq );
free( aItem );
if ( pItem ) {
FreeHashItem( pItem );
}
aItem = next;
}
}

Expand Down

0 comments on commit 6b84a18

Please sign in to comment.