libgda r3107 - in branches/release-3-0-branch: . libgda providers/postgres



Author: murrayc
Date: Thu Apr  3 20:30:18 2008
New Revision: 3107
URL: http://svn.gnome.org/viewvc/libgda?rev=3107&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/release-3-0-branch/ChangeLog
   branches/release-3-0-branch/libgda/gda-config.c
   branches/release-3-0-branch/providers/postgres/gda-postgres-provider.c
   branches/release-3-0-branch/providers/postgres/gda-postgres-recordset.c
   branches/release-3-0-branch/providers/postgres/libmain.c

Modified: branches/release-3-0-branch/libgda/gda-config.c
==============================================================================
--- branches/release-3-0-branch/libgda/gda-config.c	(original)
+++ branches/release-3-0-branch/libgda/gda-config.c	Thu Apr  3 20:30:18 2008
@@ -279,7 +279,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;
@@ -1569,7 +1569,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/release-3-0-branch/providers/postgres/gda-postgres-provider.c
==============================================================================
--- branches/release-3-0-branch/providers/postgres/gda-postgres-provider.c	(original)
+++ branches/release-3-0-branch/providers/postgres/gda-postgres-provider.c	Thu Apr  3 20:30:18 2008
@@ -433,10 +433,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;
@@ -695,6 +697,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/release-3-0-branch/providers/postgres/gda-postgres-recordset.c
==============================================================================
--- branches/release-3-0-branch/providers/postgres/gda-postgres-recordset.c	(original)
+++ branches/release-3-0-branch/providers/postgres/gda-postgres-recordset.c	Thu Apr  3 20:30:18 2008
@@ -112,6 +112,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/release-3-0-branch/providers/postgres/libmain.c
==============================================================================
--- branches/release-3-0-branch/providers/postgres/libmain.c	(original)
+++ branches/release-3-0-branch/providers/postgres/libmain.c	Thu Apr  3 20:30:18 2008
@@ -35,6 +35,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]