fix a memory bug in xhash

This commit is contained in:
Yuichi Nishiwaki 2013-10-23 20:09:06 +09:00
parent 2ec7f381d0
commit 05f1b4551d
1 changed files with 3 additions and 2 deletions

View File

@ -88,14 +88,15 @@ static inline void
xh_destory(struct xhash *x)
{
int i;
struct xh_entry *e;
struct xh_entry *e, *d;
for (i = 0; i < x->size; ++i) {
e = x->buckets[i];
while (e) {
d = e->next;
free((void*)e->key);
e = e->next;
free(e);
e = d;
}
}
free(x);