Index: ossp-pkg/val/val.c RCS File: /v/ossp/cvs/ossp-pkg/val/val.c,v rcsdiff -q -kk '-r1.6' '-r1.7' -u '/v/ossp/cvs/ossp-pkg/val/val.c,v' 2>/dev/null --- val.c 2002/01/17 12:19:09 1.6 +++ val.c 2002/01/18 18:12:33 1.7 @@ -516,7 +516,7 @@ /* destroy the whole hash table */ static int lh_destroy(lh_t *h) { - element_t *el, **pel; + element_t *el, **pel, *el_next; unsigned int i, j; /* argument consistency check */ @@ -533,10 +533,13 @@ continue; /* deallocate all elements in collision chain */ pel = &h->h_dir[i]->s_element[j]; - for (el = *pel; el != NULL; el = el->e_next) { + for (el = *pel; el != NULL; ) { /* deallocate key+data memory chunk */ if (el->e_keyptr != NULL) free(el->e_keyptr); + el_next = el->e_next; + free(el); + el = el_next; } } free(h->h_dir[i]);