[xchat-gnome] Bug 652868 - don't free items before passing them to g_slist_remove
- From: Ritesh Khadgaray <rkhadgaray src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [xchat-gnome] Bug 652868 - don't free items before passing them to g_slist_remove
- Date: Mon, 20 Jun 2011 12:04:10 +0000 (UTC)
commit 9fa1a5bc7a50fc415c9fa02011faa44378487362
Author: Bill Nottingham <notting redhat com>
Date: Mon Jun 20 17:31:33 2011 +0530
Bug 652868 - don't free items before passing them to g_slist_remove
src/common/cfgfiles.c | 2 +-
src/common/plugin.c | 2 +-
src/common/servlist.c | 22 +++++++++++-----------
3 files changed, 13 insertions(+), 13 deletions(-)
---
diff --git a/src/common/cfgfiles.c b/src/common/cfgfiles.c
index 6c70727..330967a 100644
--- a/src/common/cfgfiles.c
+++ b/src/common/cfgfiles.c
@@ -140,8 +140,8 @@ list_free (GSList ** list)
while (*list)
{
data = (void *) (*list)->data;
- free (data);
*list = g_slist_remove (*list, data);
+ free (data);
}
}
diff --git a/src/common/plugin.c b/src/common/plugin.c
index 0889dca..c6a67ac 100644
--- a/src/common/plugin.c
+++ b/src/common/plugin.c
@@ -160,9 +160,9 @@ xit:
}
if (pl->filename)
free ((char *)pl->filename);
- free (pl);
plugin_list = g_slist_remove (plugin_list, pl);
+ free (pl);
#ifdef USE_PLUGIN
fe_pluginlist_update ();
diff --git a/src/common/servlist.c b/src/common/servlist.c
index 3082966..b38ac4f 100644
--- a/src/common/servlist.c
+++ b/src/common/servlist.c
@@ -792,9 +792,9 @@ servlist_server_add (ircnet *net, char *name)
void
servlist_server_remove (ircnet *net, ircserver *serv)
{
+ net->servlist = g_slist_remove (net->servlist, serv);
free (serv->hostname);
free (serv);
- net->servlist = g_slist_remove (net->servlist, serv);
}
static void
@@ -818,6 +818,16 @@ servlist_net_remove (ircnet *net)
servlist_server_remove_all (net);
network_list = g_slist_remove (network_list, net);
+ /* for safety */
+ list = serv_list;
+ while (list)
+ {
+ serv = list->data;
+ if (serv->network == net)
+ serv->network = NULL;
+ list = list->next;
+ }
+
if (net->nick)
free (net->nick);
if (net->nick2)
@@ -840,16 +850,6 @@ servlist_net_remove (ircnet *net)
free (net->encoding);
free (net->name);
free (net);
-
- /* for safety */
- list = serv_list;
- while (list)
- {
- serv = list->data;
- if (serv->network == net)
- serv->network = NULL;
- list = list->next;
- }
}
ircnet *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]