mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
Added MODULE_DATA_UNSET() macro and started using it. Just to make sure we
don't try to access free'd data. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1818 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
56331f78e0
commit
c988af4150
@ -10,6 +10,9 @@
|
|||||||
#define MODULE_DATA_SET(rec, data) \
|
#define MODULE_DATA_SET(rec, data) \
|
||||||
g_hash_table_insert((rec)->module_data, MODULE_NAME, data)
|
g_hash_table_insert((rec)->module_data, MODULE_NAME, data)
|
||||||
|
|
||||||
|
#define MODULE_DATA_UNSET(rec) \
|
||||||
|
g_hash_table_remove((rec)->module_data, MODULE_NAME)
|
||||||
|
|
||||||
#define MODULE_DATA(rec) \
|
#define MODULE_DATA(rec) \
|
||||||
g_hash_table_lookup((rec)->module_data, MODULE_NAME)
|
g_hash_table_lookup((rec)->module_data, MODULE_NAME)
|
||||||
|
|
||||||
|
@ -111,6 +111,7 @@ static void sig_connected(SERVER_REC *server)
|
|||||||
static void sig_disconnected(SERVER_REC *server)
|
static void sig_disconnected(SERVER_REC *server)
|
||||||
{
|
{
|
||||||
g_free(MODULE_DATA(server));
|
g_free(MODULE_DATA(server));
|
||||||
|
MODULE_DATA_UNSET(server);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sig_channel_created(CHANNEL_REC *channel)
|
static void sig_channel_created(CHANNEL_REC *channel)
|
||||||
@ -121,6 +122,7 @@ static void sig_channel_created(CHANNEL_REC *channel)
|
|||||||
static void sig_channel_destroyed(CHANNEL_REC *channel)
|
static void sig_channel_destroyed(CHANNEL_REC *channel)
|
||||||
{
|
{
|
||||||
g_free(MODULE_DATA(channel));
|
g_free(MODULE_DATA(channel));
|
||||||
|
MODULE_DATA_UNSET(channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
void fe_common_core_init(void)
|
void fe_common_core_init(void)
|
||||||
|
@ -160,6 +160,7 @@ static void flood_deinit_server(IRC_SERVER_REC *server)
|
|||||||
g_hash_table_destroy(mserver->floodlist);
|
g_hash_table_destroy(mserver->floodlist);
|
||||||
}
|
}
|
||||||
g_free(mserver);
|
g_free(mserver);
|
||||||
|
MODULE_DATA_UNSET(server);
|
||||||
}
|
}
|
||||||
|
|
||||||
static FLOOD_ITEM_REC *flood_find(FLOOD_REC *flood, int level,
|
static FLOOD_ITEM_REC *flood_find(FLOOD_REC *flood, int level,
|
||||||
|
@ -218,6 +218,7 @@ static void notifylist_deinit_server(IRC_SERVER_REC *server)
|
|||||||
notify_nick_destroy(rec);
|
notify_nick_destroy(rec);
|
||||||
}
|
}
|
||||||
g_free(mserver);
|
g_free(mserver);
|
||||||
|
MODULE_DATA_UNSET(server);
|
||||||
}
|
}
|
||||||
|
|
||||||
void notifylist_left(IRC_SERVER_REC *server, NOTIFY_NICK_REC *rec)
|
void notifylist_left(IRC_SERVER_REC *server, NOTIFY_NICK_REC *rec)
|
||||||
|
Loading…
Reference in New Issue
Block a user