From 05f1b4551df1ea2cb81e3e788d8ed7d9ef6c1ec6 Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Wed, 23 Oct 2013 20:09:06 +0900 Subject: [PATCH] fix a memory bug in xhash --- extlib/xhash/xhash.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/extlib/xhash/xhash.h b/extlib/xhash/xhash.h index 3b9509c0..3566e5d9 100644 --- a/extlib/xhash/xhash.h +++ b/extlib/xhash/xhash.h @@ -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);