libgda r3108 - in branches/libgda-3-2: . libgda providers/postgres



Author: murrayc
Date: Thu Apr  3 20:32:18 2008
New Revision: 3108
URL: http://svn.gnome.org/viewvc/libgda?rev=3108&view=rev

Log:
2008-04-03  Murray Cumming  <murrayc murrayc com>

* libgda/gda-config.c (gda_config_get_provider_list, get_config_client):
Use g_getenv() instead of getenv() for portability.
* providers/postgres/gda-postgres-provider.c (get_connection_type_list,
  gda_postgres_provider_close_connection): Free any_type_oid instead of 
leaking it.
* providers/postgres/gda-postgres-recordset.c
  (gda_postgres_recordset_finalize): Free table_name instead of leaking 
it.
* providers/postgres/libmain.c (plugin_init): Add a comment that the 
module path is leaked, but that it is not a big deal.

Modified:
   branches/libgda-3-2/ChangeLog
   branches/libgda-3-2/libgda/gda-config.c
   branches/libgda-3-2/providers/postgres/gda-postgres-provider.c
   branches/libgda-3-2/providers/postgres/gda-postgres-recordset.c
   branches/libgda-3-2/providers/postgres/libmain.c

Modified: branches/libgda-3-2/libgda/gda-config.c
==============================================================================
--- branches/libgda-3-2/libgda/gda-config.c	(original)
+++ branches/libgda-3-2/libgda/gda-config.c	Thu Apr  3 20:32:18 2008
@@ -291,7 +291,7 @@
 		xmlKeepBlanksDefault(0);
 
 		/* check if DSN list should only be stored in memory */
-		memonly = getenv ("GDA_DSN_LIST_IN_MEMORY");
+		memonly = g_getenv ("GDA_DSN_LIST_IN_MEMORY");
 		if (memonly) {
 			gsize length;
 			gchar *init_contents;
@@ -1666,7 +1666,7 @@
 	if (!prov_list) {
 		const gchar *from_dir;
 
-		from_dir = getenv ("GDA_PROVIDERS_ROOT_DIR");
+		from_dir = g_getenv ("GDA_PROVIDERS_ROOT_DIR");
 		if (from_dir)
 			prov_list = load_providers_from_dir (from_dir, TRUE);
 		else {

Modified: branches/libgda-3-2/providers/postgres/gda-postgres-provider.c
==============================================================================
--- branches/libgda-3-2/providers/postgres/gda-postgres-provider.c	(original)
+++ branches/libgda-3-2/providers/postgres/gda-postgres-provider.c	Thu Apr  3 20:32:18 2008
@@ -436,10 +436,12 @@
 	g_string_free (string, FALSE);
 
 	/* make a string of the oid of type 'any' */
-	priv_td->any_type_oid = "";
+	priv_td->any_type_oid = g_strdup("");
 	if (pg_res_anyoid) {
-		if (PQntuples (pg_res_anyoid) == 1) 
+		if (PQntuples (pg_res_anyoid) == 1) {
+			g_free (priv_td->any_type_oid);
 			priv_td->any_type_oid = g_strdup (PQgetvalue (pg_res_anyoid, 0, 0));
+		}
 		PQclear (pg_res_anyoid);
 	}
 	return 0;
@@ -699,6 +701,7 @@
 	g_free (priv_data->type_data);
 	g_free (priv_data->version);
 	g_free (priv_data->avoid_types_oids);
+        g_free (priv_data->any_type_oid);
 	g_free (priv_data);
 
 	g_object_set_data (G_OBJECT (cnc), OBJECT_DATA_POSTGRES_HANDLE, NULL);

Modified: branches/libgda-3-2/providers/postgres/gda-postgres-recordset.c
==============================================================================
--- branches/libgda-3-2/providers/postgres/gda-postgres-recordset.c	(original)
+++ branches/libgda-3-2/providers/postgres/gda-postgres-recordset.c	Thu Apr  3 20:32:18 2008
@@ -109,6 +109,10 @@
 
 	g_free (recset->priv->column_types);
 	recset->priv->column_types = NULL;
+
+        g_free (recset->priv->table_name);
+        recset->priv->table_name = NULL;
+
 	g_free (recset->priv);
 	recset->priv = NULL;
 

Modified: branches/libgda-3-2/providers/postgres/libmain.c
==============================================================================
--- branches/libgda-3-2/providers/postgres/libmain.c	(original)
+++ branches/libgda-3-2/providers/postgres/libmain.c	Thu Apr  3 20:32:18 2008
@@ -36,6 +36,8 @@
 void
 plugin_init (const gchar *real_path)
 {
+	/* This is never freed, but that is OK. It is only called once. */
+	/* But it would be nice to have some cleanup function just to shut valgrind up. murrayc. */
 	if (real_path)
 		module_path = g_strdup (real_path);
 }



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