summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2002-12-10 20:30:03 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2002-12-10 20:30:03 +0000
commit6825f1e67eb5ccf5083ef5e848f9c9f8de222170 (patch)
tree61d23cd280d3f70c2bdb09bdd4c2f97c4dde4540
parentbb55d3ff4d0b9f889f3c9834c10ad014f2edf9a1 (diff)
downloadirssi-6825f1e67eb5ccf5083ef5e848f9c9f8de222170.zip
GC fixes.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3056 dbcabf3a-b0e7-0310-adc4-f8d773084564
-rw-r--r--src/fe-common/irc/fe-netjoin.c8
-rw-r--r--src/fe-text/textbuffer-view.c8
-rw-r--r--src/irc/core/mode-lists.c4
-rw-r--r--src/irc/dcc/dcc.c2
-rw-r--r--src/irc/flood/flood.c4
-rw-r--r--src/perl/perl-common.c9
6 files changed, 19 insertions, 16 deletions
diff --git a/src/fe-common/irc/fe-netjoin.c b/src/fe-common/irc/fe-netjoin.c
index 90cf76b7..3d4bcc40 100644
--- a/src/fe-common/irc/fe-netjoin.c
+++ b/src/fe-common/irc/fe-netjoin.c
@@ -209,15 +209,15 @@ static void print_netjoins(NETJOIN_SERVER_REC *server)
old = gslist_find_icase_string(rec->old_channels,
realchannel);
if (old != NULL) {
- g_free(old->data);
+ void *data = old->data;
rec->old_channels =
- g_slist_remove(rec->old_channels,
- old->data);
+ g_slist_remove(rec->old_channels, data);
+ g_free(data);
}
- g_free(channel);
rec->now_channels =
g_slist_remove(rec->now_channels, channel);
+ g_free(channel);
}
if (rec->old_channels == NULL)
diff --git a/src/fe-text/textbuffer-view.c b/src/fe-text/textbuffer-view.c
index 77b21a2e..8eddae2f 100644
--- a/src/fe-text/textbuffer-view.c
+++ b/src/fe-text/textbuffer-view.c
@@ -268,11 +268,13 @@ view_update_line_cache(TEXT_BUFFER_VIEW_REC *view, LINE_REC *line)
if (rec->count > 1) {
for (pos = 0; lines != NULL; pos++) {
- memcpy(&rec->lines[pos], lines->data,
+ void *data = lines->data;
+
+ memcpy(&rec->lines[pos], data,
sizeof(LINE_CACHE_SUB_REC));
- g_free(lines->data);
- lines = g_slist_remove(lines, lines->data);
+ lines = g_slist_remove(lines, data);
+ g_free(data);
}
}
diff --git a/src/irc/core/mode-lists.c b/src/irc/core/mode-lists.c
index 9d85e133..ee60f1b2 100644
--- a/src/irc/core/mode-lists.c
+++ b/src/irc/core/mode-lists.c
@@ -31,11 +31,11 @@ static void ban_free(GSList **list, BAN_REC *rec)
g_return_if_fail(list != NULL);
g_return_if_fail(rec != NULL);
+ *list = g_slist_remove(*list, rec);
+
g_free(rec->ban);
g_free_not_null(rec->setby);
g_free(rec);
-
- *list = g_slist_remove(*list, rec);
}
void banlist_free(GSList *banlist)
diff --git a/src/irc/dcc/dcc.c b/src/irc/dcc/dcc.c
index 9a4882e5..44ef3f20 100644
--- a/src/irc/dcc/dcc.c
+++ b/src/irc/dcc/dcc.c
@@ -57,8 +57,8 @@ void dcc_unregister_type(const char *type)
pos = gslist_find_string(dcc_types, type);
if (pos != NULL) {
- g_free(pos->data);
dcc_types = g_slist_remove(dcc_types, pos->data);
+ g_free(pos->data);
}
}
diff --git a/src/irc/flood/flood.c b/src/irc/flood/flood.c
index 320ec5c6..872db941 100644
--- a/src/irc/flood/flood.c
+++ b/src/irc/flood/flood.c
@@ -129,12 +129,12 @@ static void flood_hash_destroy(const char *key, FLOOD_REC *flood)
while (flood->items != NULL) {
FLOOD_ITEM_REC *rec = flood->items->data;
+ flood->items = g_slist_remove(flood->items, rec);
+
g_slist_foreach(rec->msgtimes, (GFunc) g_free, NULL);
g_slist_free(rec->msgtimes);
g_free(rec->target);
g_free(rec);
-
- flood->items = g_slist_remove(flood->items, rec);
}
g_free(flood->nick);
diff --git a/src/perl/perl-common.c b/src/perl/perl-common.c
index cd23afe5..d39d351c 100644
--- a/src/perl/perl-common.c
+++ b/src/perl/perl-common.c
@@ -613,13 +613,14 @@ static int free_iobject_proto(void *key, void *value, void *chat_type)
static void perl_unregister_protocol(CHAT_PROTOCOL_REC *rec)
{
- GSList *item;
+ GSList *item;
+ void *data;
item = gslist_find_icase_string(use_protocols, rec->name);
if (item != NULL) {
- g_free(item->data);
- use_protocols =
- g_slist_remove(use_protocols, item->data);
+ data = item->data;
+ use_protocols = g_slist_remove(use_protocols, data);
+ g_free(data);
}
g_hash_table_foreach_remove(iobject_stashes,
(GHRFunc) free_iobject_proto,