[goffice] Don't use g_free instead of xmlFree. [#627700]



commit c8a2a6d7586284c63f38fed3d80d4e2ba1ee62c2
Author: Jean Brefort <jean brefort normalesup org>
Date:   Tue Aug 24 09:28:25 2010 +0200

    Don't use g_free instead of xmlFree. [#627700]

 ChangeLog                        |    8 ++++++++
 NEWS                             |    1 +
 goffice/app/go-plugin-service.c  |    6 +++---
 goffice/graph/gog-plot-engine.c  |   22 ++++++++++++----------
 goffice/utils/go-libxml-extras.c |    2 +-
 5 files changed, 25 insertions(+), 14 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 39fe459..77b4ae9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2010-08-24  Jean Brefort  <jean brefort normalesup org>
+
+	* goffice/app/go-plugin-service.c (go_plugin_service_finalize),
+	(go_plugin_service_new): don't use g_free instead of xmlFree. [#627700]
+	* goffice/graph/gog-plot-engine.c (gog_plot_type_service_read_xml),
+	(gog_trend_line_service_read_xml): ditto.
+	* goffice/utils/go-libxml-extras.c (go_xml_node_get_bool): ditto.
+
 2010-08-23  Jean Brefort  <jean brefort normalesup org>
 
 	* goffice/utils/go-style-prefs.ui: restore centered image filling.
diff --git a/NEWS b/NEWS
index 892c392..bb9f9e7 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,7 @@ Jean:
 	* Update x and y limits when data change for xyz plots. [#627288]
 	* Do not crash when displaying cubic spline with no abscissa. [#627507]
 	* Do not save image filling with no image. [#627690]
+	* Don't use g_free instead of xmlFree. [#627700]
 
 Morten:
 	* Limit formats to sane number of decimals.  [#627066]
diff --git a/goffice/app/go-plugin-service.c b/goffice/app/go-plugin-service.c
index b5b063e..6270bac 100644
--- a/goffice/app/go-plugin-service.c
+++ b/goffice/app/go-plugin-service.c
@@ -67,7 +67,7 @@ go_plugin_service_finalize (GObject *obj)
 	GOPluginService *service = GO_PLUGIN_SERVICE (obj);
 	GObjectClass *parent_class;
 
-	g_free (service->id);
+	xmlFree (service->id);
 	service->id = NULL;
 	g_free (service->saved_description);
 	service->saved_description = NULL;
@@ -1011,13 +1011,13 @@ go_plugin_service_new (GOPlugin *plugin, xmlNode *tree, GOErrorInfo **ret_error)
 		g_free (type_str);
 		return NULL;
 	}
-	g_free (type_str);
+	xmlFree (type_str);
 
 	service = g_object_new (ctor(), NULL);
 	service->plugin = plugin;
 	service->id = go_xml_node_get_cstr (tree, "id");
 	if (service->id == NULL)
-		service->id = g_strdup ("default");
+		service->id = xmlStrdup ("default");
 
 	if (GO_PLUGIN_SERVICE_GET_CLASS (service)->read_xml != NULL) {
 		GO_PLUGIN_SERVICE_GET_CLASS (service)->read_xml (service, tree, &service_error);
diff --git a/goffice/graph/gog-plot-engine.c b/goffice/graph/gog-plot-engine.c
index adf20fa..2a40a1f 100644
--- a/goffice/graph/gog-plot-engine.c
+++ b/goffice/graph/gog-plot-engine.c
@@ -232,7 +232,7 @@ pending_plot_types_load (void)
 static void
 gog_plot_type_service_read_xml (GOPluginService *service, xmlNode *tree, GOErrorInfo **ret_error)
 {
-	char    *path;
+	char    *path, *tmp;
 	xmlNode *ptr;
 	GSList *paths = NULL;
 
@@ -242,10 +242,11 @@ gog_plot_type_service_read_xml (GOPluginService *service, xmlNode *tree, GOError
 			if (!g_path_is_absolute (path)) {
 				char const *dir = go_plugin_get_dir_name (
 					go_plugin_service_get_plugin (service));
-				char *tmp = g_build_filename (dir, path, NULL);
-				g_free (path);
-				path = tmp;
-			}
+				tmp = g_build_filename (dir, path, NULL);
+			} else
+				tmp = g_strdup (path);
+			xmlFree (path);
+			path = tmp;
 			paths = g_slist_append (paths, path);
 		}
 	GOG_PLOT_TYPE_SERVICE (service)->paths = paths;
@@ -501,7 +502,7 @@ pending_trend_line_types_load (void)
 static void
 gog_trend_line_service_read_xml (GOPluginService *service, xmlNode *tree, GOErrorInfo **ret_error)
 {
-	char    *path;
+	char    *path, *tmp;
 	xmlNode *ptr;
 	GSList *paths = NULL;
 
@@ -511,10 +512,11 @@ gog_trend_line_service_read_xml (GOPluginService *service, xmlNode *tree, GOErro
 			if (!g_path_is_absolute (path)) {
 				char const *dir = go_plugin_get_dir_name (
 					go_plugin_service_get_plugin (service));
-				char *tmp = g_build_filename (dir, path, NULL);
-				g_free (path);
-				path = tmp;
-			}
+				tmp = g_build_filename (dir, path, NULL);
+			} else
+				tmp = g_strdup (path);
+			xmlFree (path);
+			path = tmp;
 			paths = g_slist_append (paths, path);
 		}
 	GOG_TREND_LINE_SERVICE (service)->paths = paths;
diff --git a/goffice/utils/go-libxml-extras.c b/goffice/utils/go-libxml-extras.c
index 74cbbc0..ff0336f 100644
--- a/goffice/utils/go-libxml-extras.c
+++ b/goffice/utils/go-libxml-extras.c
@@ -81,7 +81,7 @@ go_xml_node_get_bool (xmlNodePtr node, char const *name, gboolean *val)
 
 	*val = (!strcmp (CXML2C (buf), "1")
 		|| 0 == g_ascii_strcasecmp (CXML2C (buf), "true"));
-	g_free (buf);
+	xmlFree (buf);
 	return TRUE;
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]