diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2003-07-06 20:08:59 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2003-07-06 20:08:59 +0800 |
commit | 55a35d634523b18ea78702d7562a40427f776a00 (patch) | |
tree | 9d4a1ddb646bdb7db118b25dc354bcc39acd683f /lib | |
parent | 03d457e1fcc30913c79ffbd89a0028cf50426d5c (diff) | |
download | gsoc2013-epiphany-55a35d634523b18ea78702d7562a40427f776a00.tar gsoc2013-epiphany-55a35d634523b18ea78702d7562a40427f776a00.tar.gz gsoc2013-epiphany-55a35d634523b18ea78702d7562a40427f776a00.tar.bz2 gsoc2013-epiphany-55a35d634523b18ea78702d7562a40427f776a00.tar.lz gsoc2013-epiphany-55a35d634523b18ea78702d7562a40427f776a00.tar.xz gsoc2013-epiphany-55a35d634523b18ea78702d7562a40427f776a00.tar.zst gsoc2013-epiphany-55a35d634523b18ea78702d7562a40427f776a00.zip |
Fix mem leak.
2003-07-06 Christian Persch <chpe@cvs.gnome.org>
* lib/ephy-node.c: (ephy_node_finalize):
Fix mem leak.
* lib/ephy-node.c: (ephy_node_save_to_xml), (ephy_node_new_from_xml):
Use locale-independent functions g_ascii_strtod and g_ascii_dtostr
when reading/writing float and double values.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ephy-node.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/lib/ephy-node.c b/lib/ephy-node.c index 6b88c352f..6d9d9adab 100644 --- a/lib/ephy-node.c +++ b/lib/ephy-node.c @@ -22,6 +22,7 @@ #include <config.h> #endif +#include <glib.h> #include <bonobo/bonobo-i18n.h> #include <stdlib.h> #include <string.h> @@ -206,6 +207,7 @@ ephy_node_finalize (EphyNode *node) g_ptr_array_free (node->children, FALSE); g_static_rw_lock_free (node->lock); + g_free (node->lock); g_free (node); } @@ -781,6 +783,7 @@ ephy_node_save_to_xml (EphyNode *node, { xmlNodePtr xml_node; char *xml; + char xml_buf [G_ASCII_DTOSTR_BUF_SIZE]; guint i; g_return_if_fail (EPHY_IS_NODE (node)); @@ -834,14 +837,14 @@ ephy_node_save_to_xml (EphyNode *node, g_free (xml); break; case G_TYPE_FLOAT: - xml = g_strdup_printf ("%f", g_value_get_float (value)); - xmlNodeSetContent (value_xml_node, xml); - g_free (xml); + g_ascii_dtostr (xml_buf, sizeof (xml_buf), + g_value_get_float (value)); + xmlNodeSetContent (value_xml_node, xml_buf); break; case G_TYPE_DOUBLE: - xml = g_strdup_printf ("%f", g_value_get_double (value)); - xmlNodeSetContent (value_xml_node, xml); - g_free (xml); + g_ascii_dtostr (xml_buf, sizeof (xml_buf), + g_value_get_double (value)); + xmlNodeSetContent (value_xml_node, xml_buf); break; case G_TYPE_POINTER: { @@ -967,10 +970,10 @@ ephy_node_new_from_xml (EphyNodeDb *db, xmlNodePtr xml_node) g_value_set_long (value, atol (xml)); break; case G_TYPE_FLOAT: - g_value_set_float (value, atof (xml)); + g_value_set_float (value, g_ascii_strtod (xml, NULL)); break; case G_TYPE_DOUBLE: - g_value_set_double (value, atof (xml)); + g_value_set_double (value, g_ascii_strtod (xml, NULL)); break; case G_TYPE_POINTER: { |