Fix leak in hash table if same key added twice.

This commit is contained in:
James Canete
2008-03-07 00:09:28 +00:00
parent 001e8ec674
commit c9d7b85788

View File

@@ -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;