From c9d7b8578875a7de9724d5b39da3a6517549ec8f Mon Sep 17 00:00:00 2001 From: James Canete Date: Fri, 7 Mar 2008 00:09:28 +0000 Subject: [PATCH] Fix leak in hash table if same key added twice. --- src/hash.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/hash.c b/src/hash.c index 60192ba..4dee5b8 100644 --- a/src/hash.c +++ b/src/hash.c @@ -129,6 +129,9 @@ int hash_add(hash_t *table, const char * const key, void *data) hashentry_t *entry = NULL; int index = _hash_key(table, key); + /* drop existing entry, if any */ + hash_drop(table, key); + /* allocate and fill a new entry */ entry = xmpp_alloc(ctx, sizeof(hashentry_t)); if (!entry) return -1;