aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2003-01-09 14:43:31 +0800
committerMichael Zucci <zucchi@src.gnome.org>2003-01-09 14:43:31 +0800
commit9cdee141ad068801a54b004dd4e17cd325b64eae (patch)
tree003c48b4e6b453f16b771369595956c57fe3abbd /mail
parentf255677bd1b01696cb44acb599855813d2f70eb8 (diff)
downloadgsoc2013-evolution-9cdee141ad068801a54b004dd4e17cd325b64eae.tar
gsoc2013-evolution-9cdee141ad068801a54b004dd4e17cd325b64eae.tar.gz
gsoc2013-evolution-9cdee141ad068801a54b004dd4e17cd325b64eae.tar.bz2
gsoc2013-evolution-9cdee141ad068801a54b004dd4e17cd325b64eae.tar.lz
gsoc2013-evolution-9cdee141ad068801a54b004dd4e17cd325b64eae.tar.xz
gsoc2013-evolution-9cdee141ad068801a54b004dd4e17cd325b64eae.tar.zst
gsoc2013-evolution-9cdee141ad068801a54b004dd4e17cd325b64eae.zip
g_free->xmlFree (account_to_xml): copy xml memory to glib memory when
2003-01-09 Not Zed <NotZed@Ximian.com> * mail-config.c (xml_get_prop): g_free->xmlFree (account_to_xml): copy xml memory to glib memory when adding the 0 on the end of the string. (accounts_save): Use slightly different logic with appending to the tail of the list, we can't use the &node trick with gslists. (accounts_changed): Same here. svn path=/trunk/; revision=19306
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog9
-rw-r--r--mail/mail-config.c36
2 files changed, 29 insertions, 16 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index f650c14948..58a4c4247b 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,12 @@
+2003-01-09 Not Zed <NotZed@Ximian.com>
+
+ * mail-config.c (xml_get_prop): g_free->xmlFree
+ (account_to_xml): copy xml memory to glib memory when adding the 0
+ on the end of the string.
+ (accounts_save): Use slightly different logic with appending to
+ the tail of the list, we can't use the &node trick with gslists.
+ (accounts_changed): Same here.
+
2003-01-08 Ettore Perazzoli <ettore@ximian.com>
* Makefile.am: Images are now in $(datadir)/evolution/images
diff --git a/mail/mail-config.c b/mail/mail-config.c
index 78bea6fd29..2e8edde06f 100644
--- a/mail/mail-config.c
+++ b/mail/mail-config.c
@@ -300,7 +300,7 @@ xml_get_prop (xmlNodePtr node, const char *name)
buf = xmlGetProp (node, name);
val = g_strdup (buf);
- g_free (buf);
+ xmlFree (buf);
return val;
}
@@ -532,15 +532,14 @@ account_to_xml (MailConfigAccount *account)
xmlDocDumpMemory (doc, &xmlbuf, &n);
xmlFreeDoc (doc);
-
- if (!(tmp = realloc (xmlbuf, n + 1))) {
- g_free (xmlbuf);
- return NULL;
- }
-
- xmlbuf[n] = '\0';
-
- return xmlbuf;
+
+ /* remap to glib memory */
+ tmp = g_malloc(n+1);
+ memcpy(tmp, xmlbuf, n);
+ tmp[n] = 0;
+ xmlFree(xmlbuf);
+
+ return tmp;
}
static void
@@ -560,8 +559,7 @@ accounts_changed (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointe
config->accounts = NULL;
}
- tail = (GSList *) &config->accounts;
-
+ tail = NULL;
list = gconf_client_get_list (config->gconf, "/apps/evolution/mail/accounts",
GCONF_VALUE_STRING, NULL);
@@ -574,7 +572,10 @@ accounts_changed (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointe
n->data = account;
n->next = NULL;
- tail->next = n;
+ if (tail == NULL)
+ config->accounts = n;
+ else
+ tail->next = n;
tail = n;
}
@@ -591,7 +592,7 @@ accounts_save (void)
char *xmlbuf;
list = NULL;
- tail = (GSList *) &list;
+ tail = NULL;
l = config->accounts;
while (l != NULL) {
@@ -599,8 +600,11 @@ accounts_save (void)
n = g_slist_alloc ();
n->data = xmlbuf;
n->next = NULL;
-
- tail->next = n;
+
+ if (tail == NULL)
+ list = n;
+ else
+ tail->next = n;
tail = n;
}