libgda r3084 - in trunk: . libgda



Author: murrayc
Date: Mon Mar 17 00:21:24 2008
New Revision: 3084
URL: http://svn.gnome.org/viewvc/libgda?rev=3084&view=rev

Log:
2008-03-17  Phil Longstaff  <plongstaff rogers com>

* libgda/gda-data-model-array.c (gda_data_model_array_copy_model):
* libgda/gda-data-model.c (find_column_from_id, add_xml_row):
* libgda/gda-server-operation.c (gda_server_operation_get_node_info,
  gda_server_operation_get_value_at,
  gda_server_operation_set_value_at):
* libgda/gda-util.c (gda_utility_data_model_dump_data_to_xml,
  gda_utility_holder_load_attributes):  Fixed some obvious memory leaks 
by freeing variables.

Modified:
   trunk/ChangeLog
   trunk/libgda/gda-data-model-array.c
   trunk/libgda/gda-data-model.c
   trunk/libgda/gda-server-operation.c
   trunk/libgda/gda-util.c

Modified: trunk/libgda/gda-data-model-array.c
==============================================================================
--- trunk/libgda/gda-data-model-array.c	(original)
+++ trunk/libgda/gda-data-model-array.c	Mon Mar 17 00:21:24 2008
@@ -440,6 +440,7 @@
 
 		g_object_get (G_OBJECT (srccol), "id", &colid, NULL);
 		g_object_set (G_OBJECT (copycol), "id", colid, NULL);
+		g_free(colid);
 		gda_column_set_title (copycol, gda_column_get_title (srccol));
 		gda_column_set_defined_size (copycol, gda_column_get_defined_size (srccol));
 		gda_column_set_name (copycol, gda_column_get_name (srccol));

Modified: trunk/libgda/gda-data-model.c
==============================================================================
--- trunk/libgda/gda-data-model.c	(original)
+++ trunk/libgda/gda-data-model.c	Mon Mar 17 00:21:24 2008
@@ -1462,13 +1462,15 @@
 	/* assume @colid is the ID of a column */
 	nbcols = gda_data_model_get_n_columns (model);
 	for (c = 0; !column && (c < nbcols); c++) {
-		const gchar *id;
+		gchar *id;
 		column = gda_data_model_describe_column (model, c);
 		g_object_get (column, "id", &id, NULL);
 		if (!id || strcmp (id, colid)) 
 			column = NULL;
 		else
 			*pos = c;
+		if(id != NULL)
+			g_free(id);
 	}
 
 	/* if no column has been found, assumr @colid is like "_%d" where %d is a column number */
@@ -1558,10 +1560,14 @@
 
 		if (!nullforced) {
 			value = g_new0 (GValue, 1);
-			if (!gda_value_set_from_string (value, (gchar*)xmlNodeGetContent (xml_field), gdatype)) {
+			gchar* nodeval = (gchar*)xmlNodeGetContent (xml_field);
+			if (!gda_value_set_from_string (value, nodeval, gdatype)) {
 				g_free (value);
+  				xmlFree(nodeval);
 				value = gda_value_new_null ();
 			}
+
+			xmlFree(nodeval);
 		}
 
 		g_ptr_array_index (values, pos) = value;

Modified: trunk/libgda/gda-server-operation.c
==============================================================================
--- trunk/libgda/gda-server-operation.c	(original)
+++ trunk/libgda/gda-server-operation.c	Mon Mar 17 00:21:24 2008
@@ -1031,6 +1031,7 @@
 					g_object_get (G_OBJECT (column), "id", &colid, NULL);
 					if (!colid || strcmp (colid, extension +1))
 						column = NULL;
+					g_free(colid);
 				}
 			}
 			g_free (extension);
@@ -1840,6 +1841,7 @@
 					value = gda_data_model_get_value_at (node_info->model, 
 									     gda_column_get_position (node_info->column), 
 									     row);
+				g_free(extension);
 			}
 			g_free (str);
 		}		
@@ -1980,6 +1982,7 @@
 					g_object_get (G_OBJECT (column), "id", &colid, NULL);
 					if (!colid || strcmp (colid, colname +1))
 						column = NULL;
+					g_free(colid);
 				}
 				if (column) {
 					gchar *ptr;
@@ -2039,6 +2042,7 @@
 
 	g_free (extension);
 	g_free (colname);
+	g_free (path);
 	return allok;
 }
 

Modified: trunk/libgda/gda-util.c
==============================================================================
--- trunk/libgda/gda-util.c	(original)
+++ trunk/libgda/gda-util.c	Mon Mar 17 00:21:24 2008
@@ -666,10 +666,13 @@
 		
 			column = gda_data_model_describe_column (model, rcols [c]);
 			g_object_get (G_OBJECT (column), "id", &id, NULL);
+
 			if (id && *id)
 				col_ids [c] = g_strdup (id);
 			else
 				col_ids [c] = g_strdup_printf ("_%d", c);
+
+			g_free(id);
 		}
 	}
 
@@ -860,14 +863,17 @@
 			
 			if (!isnull) {
 				GValue *value;
+				gchar* nodeval = (gchar*)xmlNodeGetContent (vnode);
 
 				value = g_new0 (GValue, 1);
-				if (! gda_value_set_from_string (value, (gchar*)xmlNodeGetContent (vnode), gdatype)) {
+				if (! gda_value_set_from_string (value, nodeval, gdatype)) {
 					/* error */
 					g_free (value);
 				}
 				else 
 					gda_holder_take_value (holder, value);
+
+ 				xmlFree(nodeval);
 			}
 			else {
 				gda_holder_set_value (holder, NULL);



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