diff options
author | Timo Sirainen <cras@irssi.org> | 2001-10-02 07:55:51 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2001-10-02 07:55:51 +0000 |
commit | c988af4150dba4d429496fe5e36fd219377a0935 (patch) | |
tree | c50d3e6d84deb3a856b9dcf3da63b13b376f2f8c /src | |
parent | 56331f78e0742b0418a4259e65ee1a00daa923d6 (diff) | |
download | irssi-c988af4150dba4d429496fe5e36fd219377a0935.zip |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/core/modules.h | 3 | ||||
-rw-r--r-- | src/fe-common/core/fe-common-core.c | 2 | ||||
-rw-r--r-- | src/irc/flood/flood.c | 1 | ||||
-rw-r--r-- | src/irc/notifylist/notifylist.c | 1 |
4 files changed, 7 insertions, 0 deletions
diff --git a/src/core/modules.h b/src/core/modules.h index bf2dba31..5677cace 100644 --- a/src/core/modules.h +++ b/src/core/modules.h @@ -10,6 +10,9 @@ #define MODULE_DATA_SET(rec, 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) \ g_hash_table_lookup((rec)->module_data, MODULE_NAME) diff --git a/src/fe-common/core/fe-common-core.c b/src/fe-common/core/fe-common-core.c index 0f5ce6ea..afdf8509 100644 --- a/src/fe-common/core/fe-common-core.c +++ b/src/fe-common/core/fe-common-core.c @@ -111,6 +111,7 @@ static void sig_connected(SERVER_REC *server) static void sig_disconnected(SERVER_REC *server) { g_free(MODULE_DATA(server)); + MODULE_DATA_UNSET(server); } 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) { g_free(MODULE_DATA(channel)); + MODULE_DATA_UNSET(channel); } void fe_common_core_init(void) diff --git a/src/irc/flood/flood.c b/src/irc/flood/flood.c index aa383554..d5339d4f 100644 --- a/src/irc/flood/flood.c +++ b/src/irc/flood/flood.c @@ -160,6 +160,7 @@ static void flood_deinit_server(IRC_SERVER_REC *server) g_hash_table_destroy(mserver->floodlist); } g_free(mserver); + MODULE_DATA_UNSET(server); } static FLOOD_ITEM_REC *flood_find(FLOOD_REC *flood, int level, diff --git a/src/irc/notifylist/notifylist.c b/src/irc/notifylist/notifylist.c index 09a6f7c7..402e315e 100644 --- a/src/irc/notifylist/notifylist.c +++ b/src/irc/notifylist/notifylist.c @@ -218,6 +218,7 @@ static void notifylist_deinit_server(IRC_SERVER_REC *server) notify_nick_destroy(rec); } g_free(mserver); + MODULE_DATA_UNSET(server); } void notifylist_left(IRC_SERVER_REC *server, NOTIFY_NICK_REC *rec) |