core: callback_free_key shouldn't point to already free'd value

v2.8-utf8proc
Andrew Potter 2014-08-10 15:06:46 -07:00 committed by Sébastien Helleu
parent 4faa227a2d
commit 62d891aea9
4 changed files with 10 additions and 6 deletions

View File

@ -3812,7 +3812,14 @@ my_free_value_cb (struct t_hashtable *hashtable, const void *key, void *value)
/* ... */
}
void
my_free_key_cb (struct t_hashtable *hashtable, void *key)
{
/* ... */
}
weechat_hashtable_set_pointer (hashtable, "callback_free_value", &my_free_value_cb);
weechat_hashtable_set_pointer (hashtable, "callback_free_key", &my_free_key_cb);
----
[NOTE]

View File

@ -307,8 +307,7 @@ hashtable_free_key (struct t_hashtable *hashtable,
if (hashtable->callback_free_key)
{
(void) (hashtable->callback_free_key) (hashtable,
item->key,
item->value);
item->key);
}
else
{

View File

@ -28,7 +28,7 @@ typedef unsigned long long (t_hashtable_hash_key)(struct t_hashtable *hashtable,
typedef int (t_hashtable_keycmp)(struct t_hashtable *hashtable,
const void *key1, const void *key2);
typedef void (t_hashtable_free_key)(struct t_hashtable *hashtable,
void *key, const void *value);
void *key);
typedef void (t_hashtable_free_value)(struct t_hashtable *hashtable,
const void *key, void *value);
typedef void (t_hashtable_map)(void *data,

View File

@ -2815,12 +2815,10 @@ string_shared_keycmp (struct t_hashtable *hashtable,
*/
void
string_shared_free_key (struct t_hashtable *hashtable,
void *key, const void *value)
string_shared_free_key (struct t_hashtable *hashtable, void *key)
{
/* make C compiler happy */
(void) hashtable;
(void) value;
free (key);
}