aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2011-04-19 07:16:32 +0800
committerMatthew Barnes <mbarnes@redhat.com>2011-04-19 07:19:39 +0800
commit37b3d691ca6f1cc8e305d89cd14aa35856423e8c (patch)
tree79890d4e43dddc1bcb37bac71860b87275cc00d8
parentd2390b4cc3cb3a25ef0a98596cb3ba47ce254c37 (diff)
downloadgsoc2013-evolution-37b3d691ca6f1cc8e305d89cd14aa35856423e8c.tar
gsoc2013-evolution-37b3d691ca6f1cc8e305d89cd14aa35856423e8c.tar.gz
gsoc2013-evolution-37b3d691ca6f1cc8e305d89cd14aa35856423e8c.tar.bz2
gsoc2013-evolution-37b3d691ca6f1cc8e305d89cd14aa35856423e8c.tar.lz
gsoc2013-evolution-37b3d691ca6f1cc8e305d89cd14aa35856423e8c.tar.xz
gsoc2013-evolution-37b3d691ca6f1cc8e305d89cd14aa35856423e8c.tar.zst
gsoc2013-evolution-37b3d691ca6f1cc8e305d89cd14aa35856423e8c.zip
Bug 647708 - e_plugin_xml_prop() can return libxml2 allocated memory
Always copy the xmlChar property into GLib-allocated memory. g_mem_is_system_malloc() has nothing to do with libxml2.
-rw-r--r--e-util/e-plugin.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/e-util/e-plugin.c b/e-util/e-plugin.c
index d3579b7d89..fa7f0d9d88 100644
--- a/e-util/e-plugin.c
+++ b/e-util/e-plugin.c
@@ -732,8 +732,7 @@ e_plugin_get_configure_widget (EPlugin *ep)
* @id: The name of the property to retrieve.
*
* A static helper function to look up a property on an XML node, and
- * ensure it is allocated in GLib system memory. If GLib isn't using
- * the system malloc then it must copy the property value.
+ * ensure it is allocated in GLib system memory.
*
* Return value: The property, allocated in GLib memory, or NULL if no
* such property exists.
@@ -741,17 +740,17 @@ e_plugin_get_configure_widget (EPlugin *ep)
gchar *
e_plugin_xml_prop (xmlNodePtr node, const gchar *id)
{
- gchar *p = (gchar *)xmlGetProp (node, (const guchar *)id);
+ xmlChar *xml_prop;
+ gchar *glib_prop = NULL;
- if (g_mem_is_system_malloc ()) {
- return p;
- } else {
- gchar * out = g_strdup (p);
+ xml_prop = xmlGetProp (node, (xmlChar *) id);
- if (p)
- xmlFree (p);
- return out;
+ if (xml_prop != NULL) {
+ glib_prop = g_strdup ((gchar *) xml_prop);
+ xmlFree (xml_prop);
}
+
+ return glib_prop;
}
/**