fix a memory bug in xhash
This commit is contained in:
parent
2ec7f381d0
commit
05f1b4551d
|
@ -88,14 +88,15 @@ static inline void
|
||||||
xh_destory(struct xhash *x)
|
xh_destory(struct xhash *x)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct xh_entry *e;
|
struct xh_entry *e, *d;
|
||||||
|
|
||||||
for (i = 0; i < x->size; ++i) {
|
for (i = 0; i < x->size; ++i) {
|
||||||
e = x->buckets[i];
|
e = x->buckets[i];
|
||||||
while (e) {
|
while (e) {
|
||||||
|
d = e->next;
|
||||||
free((void*)e->key);
|
free((void*)e->key);
|
||||||
e = e->next;
|
|
||||||
free(e);
|
free(e);
|
||||||
|
e = d;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(x);
|
free(x);
|
||||||
|
|
Loading…
Reference in New Issue