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
This commit is contained in:
Not Zed
2003-01-09 06:43:31 +00:00
committed by Michael Zucci
parent f255677bd1
commit 9cdee141ad
2 changed files with 29 additions and 16 deletions

View File

@ -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

View File

@ -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;
}
@ -533,14 +533,13 @@ account_to_xml (MailConfigAccount *account)
xmlDocDumpMemory (doc, &xmlbuf, &n);
xmlFreeDoc (doc);
if (!(tmp = realloc (xmlbuf, n + 1))) {
g_free (xmlbuf);
return NULL;
}
/* remap to glib memory */
tmp = g_malloc(n+1);
memcpy(tmp, xmlbuf, n);
tmp[n] = 0;
xmlFree(xmlbuf);
xmlbuf[n] = '\0';
return 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,6 +572,9 @@ accounts_changed (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointe
n->data = account;
n->next = NULL;
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) {
@ -600,6 +601,9 @@ accounts_save (void)
n->data = xmlbuf;
n->next = NULL;
if (tail == NULL)
list = n;
else
tail->next = n;
tail = n;
}