1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-29 14:26:39 +02:00

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

This commit is contained in:
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
+7
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]
+1 -2
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
{
+1 -1
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,
+1 -3
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);
}