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:
committed by
Sébastien Helleu
parent
4faa227a2d
commit
62d891aea9
@@ -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]
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user